Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Retrieving output parameters with ExecuteReader() instead ofExecuteNonQuery

Reply
Thread Tools

Retrieving output parameters with ExecuteReader() instead ofExecuteNonQuery

 
 
msch.prv@gmail.com
Guest
Posts: n/a
 
      01-26-2008
Hi, I just wonder if it is possible to retrieve sproc output
parameters with the ExecuteReader() method. I have some code that
works fine with the ExecuteNonQuery() variant, but fails with the
reader approach.

An article on 4 Guys by Scott Mitchell:
http://aspnet.4guysfromrolla.com/dem.../062905-1.aspx
seems to suggest this is feasible. For some reason, I cannot run
these examples: the output parameters return nothing. When
ExecuteNonQuery() is substituted back, parameter retrieving works.

Has anyone successfully used the ExecuteReader appproach to extract
output parameters? TIA for any pointers.
 
Reply With Quote
 
 
 
 
msch.prv@gmail.com
Guest
Posts: n/a
 
      01-26-2008
Ok, I found the error. Sproc output parameters can be extracted with
ExecuteReader(). However, the SqlDataReader must be closed before the
output parameters can be retrieved.
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      01-27-2008
it doesn't need to be closed, you just need to read all result sets
before accessing the parameters, as their values come after the last
result set. calling close process all result sets.

-- bruce (sqlwork.com)

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Ok, I found the error. Sproc output parameters can be extracted with
> ExecuteReader(). However, the SqlDataReader must be closed before the
> output parameters can be retrieved.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieving templatized object via singleton getInstance using generic template parameters gary.bernstein@gmail.com C++ 3 06-06-2007 03:25 AM
Retrieving function parameters anirbid.banerjee@gmail.com C Programming 5 02-09-2007 09:49 PM
Retrieving a recordset and Output parameters from a Stored Procedure stjulian ASP General 1 02-08-2006 06:31 PM
Retrieving Output Parameters and Recordset PinkGuava ASP General 1 09-16-2004 10:40 AM
Retrieving SQL output =?Utf-8?B?amI=?= ASP .Net 2 04-13-2004 01:37 PM



Advertisments