sqlcedatareader - how to detect a zero hit?

Hi! I am querying a sql ce server database on a pocket pc receiving results as a SqlCeDataReader. How can I detect whether my query returned any rows at all withouth moving the pointer (Read()) and without having to execute a second count(*) query.
Any clues?
kolya
[275 byte] By [kolya] at [2008-2-15]
# 1

the best/only way to do this is by testing the result from Read().

if (dataReader.Read())
{
//you have rows
}
else
{
//no rows
}
dataReader.Close();

PeterLillevold at 2007-9-8 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 2
how about using the HasRows property on the sqlcedatareader? That should not progress the pointer to the records. It would be nice to have some sort of Peek() method though.
Nazim at 2007-9-8 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 3
You know, that's the point. SqlCeDataReader does not implement the HasRows method.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlservercesqlcedatareadermemberstopic.asp
kolya
kolya at 2007-9-8 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 4

The SqlCeDataReader does not implement the HasRows method.
So aside from testing the results from Read or executing a second count(*) query there is no other way to detect (using the SqlCeDataReader) if the query returned any rows at all.
Thanks.

MarkIhimoyan at 2007-9-8 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 5
Actually SqlCeResultSet class has a "HasRows" property in NETCF v2. So you can just use that if you are currently using v2. I just tried it out and it seems to work fine.
Nazim at 2007-9-8 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...