No output parameter.......

  • Thread starter Thread starter Vickey Nelson
  • Start date Start date
V

Vickey Nelson

I am calling a stored procedure which returns the result set and output
parameter.

My code look like this..

Dim MyReader As SqlDataReader = myCmd.ExecuteReader()

If Not Convert.IsDBNull(myCmd.Parameters("@TotalCount").Value) Then

iTARCount = CType(myCmd.Parameters("@TotalCount ").Value, String)

End If

If I block the result set in the stored procedure, I can read the output
parameter. Otherwise output parameter is always zero.

I am using .Net Framework 1.1 and SQL2K.

Please advice.

Vicky
 
output parameters are not available until you have processed all rows and
results sets from the reader. so you need to read the rows first.


Dim MyReader As SqlDataReader = myCmd.ExecuteReader()

do
do while MyReader.Read()
'* process rows
loop
loop while MyReader.NextResult()

If Not Convert.IsDBNull(myCmd.Parameters("@TotalCount").Value) Then
iTARCount = CType(myCmd.Parameters("@TotalCount ").Value, String)
End If
 
Back
Top