I have a object called:
SqlCeDataReader rdr;
Because SqlCeDataReader does not have HasRows function, I wrote one:
if (!HasRows(rdr)) // Iterate to find number of rows
{
}
while (rdr.Read()) // Read the reader
{
}
The rdr.Read() does not return any result.
If I comment out the first iteration, It return result.
Thank you.
You can’t iterate twice – SqlCeDataReader “provides a way of reading a forward-only stream of data rows from a data source.” – MSDN.
But it does have a
HasRowsproperty – just use that?