I want to do database operations in AutoIt. I written some code for it, but it is not working:
Global $adCN
$adCN = ObjCreate ("ADODB.Connection") ; <== Create SQL connection
$adCN.Open ("DRIVER={SQL Server};SERVER=sqlstaging;DATABASE=NivioAsia2;uid=niviodbstaging;pwd=niviodbstaging;") ; <== Connect with required credentials
if @error Then
MsgBox(0, "ERROR", "Failed to connect to the database")
Exit
Else
MsgBox(0, "Success!", "Connection to database successful!")
EndIf
$sQuery = "select * from irws_m_users where n_userid=10318583224314"
$adCN.Execute($sQuery)
$adCN.Close ; ==> Close the database
Exit
How can I get data from table using AutoIt?
It’s done now…