Sign in to follow this  
Followers 0
bobneumann

ADODB command method

1 post in this topic

#1 ·  Posted (edited)

I'm trying to run a SQL stored procedure that will take a long time.

I think if I can run the SP in async mode, it will work, but I'm having trouble getting the syntax right.

Here's a VBScript example of what I want to do:

Dim cmd As ADODB.Command

Set cmd = New ADODB.Command

cmd.ActiveConnection = "DSN = test"

cmd.CommandTimeout = 180

cmd.CommandText = "sp_name"

cmd.CommandType = adCmdStoredProc

cmd.Execute , , adAsyncExecute

Here is my AutoIT interpretation:

$adoCon = ObjCreate("ADODB.Connection")
        $adoCon.Open ($DSN)
        $objCommand = ObjCreate("ADODB.Command")
        $objCommand.ActiveConnection = $adoCon
        $objCommand.CommandTimeout = 10
        $objCommand.CommandText = "_init_img_tables" 
;$cmdtype="adcmdstoredproc"
        $objCommand.CommandType = 4;(I got  the value "4" as the CommandTypeEnum Value for "adCmdStoredProc' from http://www.w3schools.com/ADO/prop_comm_commandtype.asp)
        $objCommand.Execute = ", 400, adAsyncExecute";(See http://www.w3schools.com/ADO/met_comm_execute.asp)

I want ..".execute , , adAsyncExecute" which means execute <no return value>,<parameter in is "400">,<with Option "adAsyncExecute">

the console output is:

C:\Program Files\autoit\test.au3 (324) : ==> The requested action with this object has failed.:

$objCommand.Execute = ", 400, adAsyncExecute"

$objCommand.Execute = ", 400, adAsyncExecute"^ ERROR

I can successfully use the "execute" method "Plain". But how do I use it with these options?

Thanks in advance,

Bob

Edited by bobneumann

Share this post


Link to post
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
Sign in to follow this  
Followers 0