I have a stored procedure and I would like it run synchronously. I runs asynchronously and I cannot trap when it completes.
The following is the code I am using:
Dim objCmd As New ADODB.Command
objCmd.CommandTimeout = 180
objCmd.CommandText = "Test_Load" 'Name of stored procedure
objCmd.CommandType = adCmdStoredProc
objCmd.ActiveConnection = adoConn
Dim objRs As ADODB.Recordset
Set objRs = objCmd.Execute
I tried:
While objCmd.State = adStateExecuting
DoEvents
Debug.Print "Executing!"
Wend
than I tried:
While objRs.State = adStateExecuting
DoEvents
Debug.Print "Executing!"
Wend
Note: This SP loads three text files into MS SQL 2000 using DTS and it loads all three files successfully, but it returns control to VB after the first files is loaded.
Any ideas?
The following is the code I am using:
Dim objCmd As New ADODB.Command
objCmd.CommandTimeout = 180
objCmd.CommandText = "Test_Load" 'Name of stored procedure
objCmd.CommandType = adCmdStoredProc
objCmd.ActiveConnection = adoConn
Dim objRs As ADODB.Recordset
Set objRs = objCmd.Execute
I tried:
While objCmd.State = adStateExecuting
DoEvents
Debug.Print "Executing!"
Wend
than I tried:
While objRs.State = adStateExecuting
DoEvents
Debug.Print "Executing!"
Wend
Note: This SP loads three text files into MS SQL 2000 using DTS and it loads all three files successfully, but it returns control to VB after the first files is loaded.
Any ideas?