Link to home
Start Free TrialLog in
Avatar of juarrero
juarreroFlag for Spain

asked on

Avoiding multiple result sets in a SP when using ExecuteReader and datareader

Hello

I have a c# datareader.read method intended to read some rows from just one table in a sql server 2005 DB by means of a stored procedure.

The SP has a final select statement which provides the desired data for the read method, but it has also some other select staments inside which are executed previously to the final select statement which provides the data.

And it seems as if there are not an only result set, but some other ones, one per each select statement in the SP. And this affects the read method.

How can I hide those select statements in the SP distinct from the the final one, in such a way they don't generate result sets which are undesirably readed by the read method?

Thanks in advance,

Juarrero
ASKER CERTIFIED SOLUTION
Avatar of RiteshShah
RiteshShah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Anthony Perkins
Why don't you post the stored procedure?  More than likely all the is requires is SET NOCOUNT ON at the start of the Stored Procedure.  But without seeing the Stored Procedure it is impossible to say for sure.
Avatar of juarrero

ASKER

These two responses have provided me with useful information.

Thanks.