System Tester Posted September 11, 2007 Share Posted September 11, 2007 Hi.AutoIt Version = 3.2.8.1Have copied SQL.AU3 to the ...include directory.SQL.AU3 Topic Link - http://www.autoitscript.com/forum/index.ph...&hl=sql.au3Attempting to run the following code....CODE#include <sql.au3>_SQLConnect ( 'server_name', 'db_name', 'user', 'password' )_SQLExecute ( 'select OFFEREDDATETIME, callstatus from cid_t_VJcallinformation where offereddatetime > "2007-09-11 00:00:01"')_SQLClose()Getting the following error.....CODE>"C:\Program Files\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\petes\My Documents\sqltest.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +> Starting AutoIt3Wrapper v.1.7.3>Running AU3Check (1.54.9.0) params: from:C:\Program Files\AutoIt3C:\PROGRA~1\AutoIt3\Include\sql.au3(14,36) : WARNING: $adCN: possibly used before declaration. $adCN.Close ;==>Close the database ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\PROGRA~1\AutoIt3\Include\sql.au3(9,35) : WARNING: $adCN: declared global in function only. Prefer top of file. Global $adCN ;<==Declare variable ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Documents and Settings\petes\My Documents\sqltest.au3 - 0 error(s), 2 warning(s)->AU3Check ended.rc:1>Running:(3.2.8.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\petes\My Documents\sqltest.au3" C:\PROGRA~1\AutoIt3\Include\sql.au3 (17) : ==> The requested action with this object has failed.: $adCN.Execute ( $query ) $adCN.Execute ( $query )^ ERROR->AutoIT3.exe ended.rc:1>Exit code: 1 Time: 4.608Can anyone help? I need to clear the error and then I need the two variables to be available for comparison. Please note - I'm a Systems Tester, not a Developer, so please bear with me! The AutoIt help file should be interrogated.The Editor should be SciTe.The forums should have been searched. Link to comment Share on other sites More sharing options...
ChrisL Posted September 11, 2007 Share Posted September 11, 2007 look in my signature I have one for MS sql [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
System Tester Posted September 11, 2007 Author Share Posted September 11, 2007 Thanks. Made some progress.1. in the SQL.AU3 include file, move the GLOBAL definition out of the function definitions, thusCODEGlobal $adCN ;<==Declare variableFunc _SQLConnect($server, $db, $username, $password) $adCN = ObjCreate ("ADODB.Connection") ;<==Create SQL connection $adCN.Open ("DRIVER={SQL Server};SERVER=" & $server & ";DATABASE=" & $db & ";uid=" & $username & ";pwd=" & $password & ";") ;<==Connect with required credentialsEndFuncFunc _SQLClose () $adCN.Close ;==>Close the databaseEndFuncFunc _SQLExecute( $query ) $adCN.Execute ( $query )EndFunc2. Edit the Select statement to remove the double quotes, replaceing with two-singlw quotes, thus_SQLExecute ( 'select OFFEREDDATETIME, callstatus from cid_t_VJcallinformation where offereddatetime > ''2007-09-11 00:00:01''')(OK, I had some help!) So now things run ok, but how do I get my data? where is it? The AutoIt help file should be interrogated.The Editor should be SciTe.The forums should have been searched. Link to comment Share on other sites More sharing options...
System Tester Posted September 11, 2007 Author Share Posted September 11, 2007 OK! Thanks to Chris I have what i'm after. it works. I don't pretend to understand it, but it works. (Monkey-see, monkey-do!) RESOLVED! The AutoIt help file should be interrogated.The Editor should be SciTe.The forums should have been searched. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now