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 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

Reply via email to