Retrieve recordset after executing a Stored Procedure?
How do I get the returned recordset data into a table variable after executing a Stored Procedure?? The only documentation on TestComplete for executing a Stored Procedure is below and talks about the Input parameters but nothing on how to retrieve the results. I've tried all sorts of ways to set my table variable equal to the execution of the Stored Proc but it seems like the results are always empty. Thanks for your help.
Chris
Sub CreatingStoredProcedure
Dim SProc
Set SProc = ADO.CreateADOStoredProc
SProc.ConnectionString = "Provider=SQLNCLI;Server=SERVER_NAME;"&_
"Database=DATABASE_NAME;Uid=USER_NAME; Pwd=PASSWORD;"
SProc.ProcedureName = "dbo.SelectFromTable"
' Adding a return parameter
Call SProc.Parameters.AddParameter()
SProc.Parameters.Items(0).name = "RETURN_VALUE"
SProc.Parameters.Items(0).DataType = adInteger
SProc.Parameters.Items(0).Direction = adParamReturnValue
SProc.Parameters.Items(0).Value = Null
' Adding an in parameter
Call SProc.Parameters.AddParameter()
SProc.Parameters.Items(1).name = "TableName"
SProc.Parameters.Items(1).DataType = ftFixedChar
SProc.Parameters.Items(1).Size = 32
SProc.Parameters.Items(1).Value = "chicken"
' Adding an in parameter
Call SProc.Parameters.AddParameter()
SProc.Parameters.Items(2).name = "Fields"
SProc.Parameters.Items(2).DataType = ftFixedChar
SProc.Parameters.Items(2).Size = 32
SProc.Parameters.Items(2).Value = "Caption"
' Adding an out parameter
'Call SProc.Parameters.AddParameter()
'SProc.Parameters.Items(2).name = "OutParamName"
'SProc.Parameters.Items(2).DataType = adSmallInt
'SProc.Parameters.Items(2).Direction = adParamOutput
'SProc.Parameters.Items(2).Value = null
' Running the procedure
Call SProc.ExecProc()
' Obtaining the return value
Call Log.Message("Result: " & SProc.Parameters.Items(0).Value)
' Call Log.Message("Result: " &_
' SProc.Parameters.ParamByName("RETURN_VALUE").Value)
End Sub