Thursday, July 23, 2009

Executing a stored procedure with output parameter doesnt return any value.

When you use a DataReader object to read data from SqlServer, the parameter passed in as output parameter doesnot get assigned even after excuting the reader.

Solution:- Close the DataReader and your value will get returned.

Reason:- The output parameter is returned at the end of the data stream when you use a DataRader.

Reference:- http://support.microsoft.com/kb/308621

No comments: