SlowCoder74 Posted October 31, 2013 Posted October 31, 2013 I'm trying to perform a simple connection to a database. Works fine on the ASP version of my code. I ported the code to AutoIT and it's not connecting. My AutoIT Code: $DBServerIP="<ip>" $DBServerName="<servername>" $DBDatabase="<db>" $DBUserID="<username>" $DBPass="<password>" $objCN = ObjCreate("ADODB.Connection") if Not IsObj($objCN) then msgbox(0,"","Not an object!") Exit endif $SQLString = "Dsn=Wallboard; Host=" & $DBServerIP & "; Server="& $DBServerName & "; Service=1504; Protocol=onsoctcp; Database=" & $DBdatabase & "; Uid=" & $DBuserID & "; Pwd=" & $DBpass $objCN.Open $SQLString if @error then msgbox(0,"","Connection NOT successful") Exit Else msgbox(0,"","Connection SUCCESSFUL!") EndIf $objCN.close None of my @errors seem to catch the problem. What I do get is this in the output pane of SCITE: ... ... (21) : ==> The requested action with this object has failed.: $objCN.Open $SQLString $objCN.Open ^ ERROR >Exit code: 1 Time: 19.452 Also, either I'm missing it, or is there no officially supported UDF for database connectivity in AutoIT?
Solution Danp2 Posted October 31, 2013 Solution Posted October 31, 2013 Try: $objCN.Open($SQLString) Fr33b0w 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
SlowCoder74 Posted October 31, 2013 Author Posted October 31, 2013 Try: $objCN.Open($SQLString) Son of a ...! It's always the little things. Thank you!
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