No output parameter.......

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
 
B

Bruce Barker

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top