Jump to content

Recommended Posts

Posted

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?

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...