Jump to content



Photo

MY Sql


  • Please log in to reply
3 replies to this topic

#1 GNGNUT

GNGNUT

    Seeker

  • Active Members
  • 23 posts

Posted 02 June 2012 - 08:33 AM

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)

Attached Files







#2 jchd

jchd

    Whatever your capacity, resistance is futile.

  • MVPs
  • 3,250 posts

Posted 02 June 2012 - 09:52 AM

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!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQL tutorial (covers generic SQL, but most of it apply to SQLite as well)An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious workPCRE v8.32 regexp pattern documentation. AutoIt uses a slightly older version so that more advanced features are not all available.RegExp tutorial: enough to get started

#3 GNGNUT

GNGNUT

    Seeker

  • Active Members
  • 23 posts

Posted 02 June 2012 - 06:42 PM

$sQuery = "select dob from Persons where address='tonbridge'"

#4 jchd

jchd

    Whatever your capacity, resistance is futile.

  • MVPs
  • 3,250 posts

Posted 03 June 2012 - 02:44 AM

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.
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQL tutorial (covers generic SQL, but most of it apply to SQLite as well)An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious workPCRE v8.32 regexp pattern documentation. AutoIt uses a slightly older version so that more advanced features are not all available.RegExp tutorial: enough to get started




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users