Hi,
I have the following code which executes a procedure. The procedure does a loop and process row by row. When I execute the procedure using Query Analyzer, everything works fine. However, when I execute the procedure using VB it processes only 18 rows (out of 180) and always stops after the second error. Can someone help me debug this issue?
Sub Main()
On Error GoTo ErrHandler
Dim myConn
Dim myCmd
Dim myRs
Dim myConnStr As String
myConnStr = "driver={SQL Server};server=APP;database=Rk;Trusted_Connection=Yes"
' instantiate the ADO objects
myCmd = CreateObject("ADODB.Command")
myRs = CreateObject("ADODB.Recordset")
myConn = CreateObject("ADODB.Connection")
With myConn
.Provider = "MSDASQL"
.CursorLocation = 3
.ConnectionString = myConnStr
.Open()
End With
myCmd.ActiveConnection = myConn
With myCmd
.CommandType = 4
.CommandText = "process_hierarchy" 'sArgs(2)
End With
' execute the command
myRs = myCmd.Execute
I have the following code which executes a procedure. The procedure does a loop and process row by row. When I execute the procedure using Query Analyzer, everything works fine. However, when I execute the procedure using VB it processes only 18 rows (out of 180) and always stops after the second error. Can someone help me debug this issue?
Sub Main()
On Error GoTo ErrHandler
Dim myConn
Dim myCmd
Dim myRs
Dim myConnStr As String
myConnStr = "driver={SQL Server};server=APP;database=Rk;Trusted_Connection=Yes"
' instantiate the ADO objects
myCmd = CreateObject("ADODB.Command")
myRs = CreateObject("ADODB.Recordset")
myConn = CreateObject("ADODB.Connection")
With myConn
.Provider = "MSDASQL"
.CursorLocation = 3
.ConnectionString = myConnStr
.Open()
End With
myCmd.ActiveConnection = myConn
With myCmd
.CommandType = 4
.CommandText = "process_hierarchy" 'sArgs(2)
End With
' execute the command
myRs = myCmd.Execute