The problem here is the DataReader. I agree that a Fill(), which is a
DataAdapter routine to fill a DataTable in a DataSet is a much better option
in most cases. But, that was not the question asked.
Overall, I would recommend everyone get used to DataSets, which drives a
co-worker nuts. I say this, as Whidbey is going to force people, more or
less, to adopt this methodology. And, since it fits well under the bar, and
is easy to maintain, it is a good idea.
But, the question was about the DataReader. As the DataReader is firehose
cursor, there is no way to know without a dual query. The method I suggested
(tieing two commands) is the lightest way to do this.
Consider an analogy of a gas station:
If you pull up to the gas station and the someone asks you "how much gas did
you purchase," you would think he was crazy, as you had not pumped yet. You
would not know until you dispensed the gas. On the other side, you could
prepay the clerk and you would know, but that is another action.
A DataReader is much like the gas transaction. Unless you query records
first, you do not know. With a DataSet, however, the transaction is complete
as soon as you call fill, although it may not seem so, as you have not bound
the data. This is due to the difference between connected (DataReader) and
disconnected (DataSet) data objects.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
**********************************************************************
Think Outside the Box!
**********************************************************************