In .NET Framework 1.1, the DataReader has a Has Rows property.
If (DataReader.HasRows)
---do something
--
forum member
http://www.visual-basic-data-mining.net/forum
"Perre Van Wilrijk" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I want to check whether my datareader object contains rows before
continuing
> and binding it to my ASP datagrid. I don't have to know how many, only if
> there's at least 1 row. I've found some solutions in several newsgroups
but
> not the solution I'm looking for.
>
> I've seen you can use a dataset and use it's rowcount property, but I
don't
> want to use a dataset only to know whether there are rows returned.
> I've seen another solution using two queries, the first to get the number
of
> rows with SQL function count(*), followed by the same query to retrieve
the
> data.
> I've seen a third solution in which you can bind your data to a datagrid
and
> than check the count property of the datagrid.
> I've seen a fourth solution in which you loop through the records with a
> read instruction but than you've to requery because the datareader is
> forward only.
>
> So, I'm not completely pleased with those solutions and wonder if there
> isn't another way. In VB6 I used to check .eof property to check whether
> there were rows returned, but it seems datareader hasn't that function.
Is
> there another way? If not ... what solution of the four above is the
best??
>
> Thanks a lot.
> --
> Kind regards,
> Perre Van Wilrijk,
> Remove capitals to get my real email address,
>
>