cloning IDbDataReader (SqlDataReader)

Peter Osucha <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <[email protected]>
In VB6 days, there were times I'd call a SQL stored procedure which returned
a recordset but also changed a stored procedure parameter that was marked as
either 'OUTPUT' or 'INPUTOUTPUT'.  To do this but still access the recordset
records, I normally ended up cloning the recordset returned so that I could
close the ADO command object - and thereby immediately access the stored
procedure OUTPUT parameters yet still have access to the recordset returned
by the stored procedure.

After reviewing the MSDN documentation, OUTPUT parameters cannot be
retrieved until after closing a SqlDataReader object - but the SqlDataReader
object doesn't support the ICloneable interface (though SqlCommand does).
So it seems easy enough to fill a SqlDataReader object using
cmd.ExecuteReader yet I can't access any stored procedure OUTPUT values
until I close the reader.

Perhaps the stored procedures need to be rethought but what could be done to
allow access to the OUTPUT parameters but still have the SqlDataReader
object to use?

Peter

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.