Jump to content

SQL... I know this SHOULD work, but never does, why?


Recommended Posts

The start of ANY SQL query within AUTOIT starts with the connection, and that's my problem. It NEVER works.

Global $adCN

$adCN = ObjCreate("ADODB.Connection")

$DSN = "DRIVER={SQL Server};SERVER=xxx;DATABASE=xxx;UID=xxx;PWD=xxx;"

$adCN.Open($DSN)

NEVER works for me.

I put in the right data in the fields above and get this no matter what I do..

Y:\AutoIT\SQL Test\sqltest.au3 (12) : ==> The requested action with this object has failed.:

$adCN.Open($DSN)

$adCN.Open($DSN)^ ERROR

The data is all correct and I'm running Scite ON the MDB server. So? It's Win Server 2008, SQL 2005,

Link to comment
Share on other sites

Greg,

Run it with this error handler and the description should point you at a solution.

$oError = ObjEvent("AutoIt.Error","_Err")

Global $adCN

$adCN = ObjCreate("ADODB.Connection")
$DSN = "DRIVER={SQL Server};SERVER=xxx;DATABASE=xxx;UID=xxx;PWD=xxx;"
$adCN.Open($DSN)


Func _Err($oError)
    ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
EndFunc

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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