More information can be found at http://support.microsoft.com/default.aspx?scid=kb;en-us;321903.
Personally, I don't like this approach. But, this is a matter of preference. -----Original Message----- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Booth, Bill Sent: Tuesday, February 17, 2004 1:51 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Stor proc return values and DataReader You might want to look at the InfoMessage Event of the connection object. That can be handy for passing messages from procs. -----Original Message----- From: Alex Ivanoff [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 17, 2004 11:16 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Stor proc return values and DataReader Lets say I have a stor proc like this: CREATE PROCEDURE spDo AS SET NOCOUNT ON SELECT name FROM Author IF (0<>@@ERROR) RETURN @@ERROR IF (2 > @@ROWCOUNT) RETURN (-1) GO In the code I have something like this: SqlCommand cmd = new SqlCommand(); ... SqlDataReader reader = cmd.ExecuteReader(); This is where the problem begins. In order to get return value from stor proc I have to close the reader. Basically, I read all the data, close reader, find out that errors occurred and throw the data away. It does not seem to be right. Is there a better approach to this? Thank you, Alex Ivanoff =================================== This list is hosted by DevelopMentorR http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorR http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com
