I have had good success in past running single threaded SPs, waiting for a "0" or "-1" reply to indicate success, using:
Set cnn = New ADODB.Connection
cnn.CursorLocation = adUseClient
cnn.ConnectionString = "driver={SQL Server};server=" & TempVars!my_ip & ";Trusted_Connection=no;Database=" & TempVars!my_Database & ";UID=username;PWD=password"
cnn.CommandTimeout = 0
cnn.Open
strSQL = "ExportToCSVZip 'myTable', '\\192.168.242.147\InventoryProcessing\Exports\', 'ProdCIVProcess', 'Y';"
Set rs = cnn.Execute(strSQL)
'SP Result -1 = Success, 0 = Fail
If rs.Fields(0) = -1 Then
msgbox "Done"
Else
msgbox "Fail"
End If
I can run this asynchronously using:
cnn.Execute strSQL, adExecuteNoRecords, adAsyncExecute
But I am unclear the proper syntax in this form to determine the Return flag. My attempts have returned an 'ordinal' error.
Suggestions?