Jump to content

Recommended Posts

Posted (edited)

Hi all,

when executing SQL statements on a mySQL server console directly, you get a return that looks somewhat like this:

l4BxgKT.jpg

How do I get that last row into a variable when executing queries in AutoIt?

I am using the ADO API.

This would especially be useful if I'm doing an UPDATE, to see how much rows are affected.

I've tried passing a variable as a second argument to the Execute method as described here, but this does not seem to work.

Global $Return, $Conn

$Conn = _IRIS_SQLConnect("myhost", "mydatabase", "myuser", "mypass")
$Conn.Execute("update active_users set username='testtest'", $return)

MsgBox(0, "", $Return)

Func _SQLConnect($ps_Server, $ps_DB, $ps_User, $ps_Pass)
    Local $lo_Connection = ObjCreate("ADODB.Connection")
    $lo_Connection.open ("DRIVER={MySQL ODBC 3.51 Driver};SERVER=" & $ps_Server & ";DATABASE=" & $ps_DB & ";UID=" & $ps_User & ";PWD=" & $ps_Pass & ";PORT=3306")
    If @error Then Return 0
    Return $lo_Connection
EndFunc

I'm getting an empty MessageBox.

Any ideas?

Edited by Radiance

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...