GNGNUT Posted June 2, 2012 Posted June 2, 2012 Hi Guys i need a little bit of help and advice on some code im trying to use to retrive data from sql 2008 r2 i can connect to my data base but cant seem to get any data back im using MYsql from cdkid and have attached the file for you guys to have a look though Please Help this is the error i keep getting C:\Program Files (x86)\AutoIt3\Include\Mysql.au3 (52) : ==> The requested action with this object has failed.: Return $oConnectionobj.execute ($sQuery) Return $oConnectionobj.execute ($sQuery)^ ERROR $sUsername = "sa" $sPassword = "####" $sDatabase = "Testing" $sServer = "(local)" $sDriver = "{SQL Server}" $iPort = 3306 $sql = _MySQLConnect($sUsername, $sPassword, $sDatabase, $sServer, $sDriver) ; $iPort) ;msgbox(0,"connected to server", $sql & ' - Error ' & @error,2) ;=> confirm connection works $result = _Query($sql,$sQuery) msgbox (0,@error,$result.field(" Name ").value,0) ;=> Value from the Sql query _MySQLEnd($sql)Mysql.au3
jchd Posted June 2, 2012 Posted June 2, 2012 And the content of $sQuery is ???I agree to give you your data back, says MySQL, but at the very least ask for it GNGNUT! This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
GNGNUT Posted June 2, 2012 Author Posted June 2, 2012 $sQuery = "select dob from Persons where address='tonbridge'"
jchd Posted June 3, 2012 Posted June 3, 2012 Is that supposed (garanteed) to give you back a non-empty resultset? I believe you can test for that with .EOF() function on the resultset: If $result.EOF() Then ; no row for this SELECT Else ; process rows as needed EndIf At least this used to work with all ADO (~ODBC) interface I know of. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
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