Check for rows in DataReader (CF 1.0)

  • Thread starter Thread starter Sascha Meyer
  • Start date Start date
S

Sascha Meyer

Hi there,

I've tried several ways to resolve this problem and also searched the
net but I'm still not satisfied with my different solutions:

how do I check for rows in a DataReader in a CompactFramework Appication
with SQL Server CE?
I tried something like
Code:
sqlSCom.CommandText = "SELECT somerows FROM sometable"
sqlSReader = sqlSCom.ExecuteReader
'Check if one row can be read from the reader
IF sqlSReader.Read THEN
.... 'read in a loop
.... do something
.... WHILE sqlSReader.Read
....... do something
.... END WHILE
END IF
and also checked for DBNull values in my IF-clause ("IF sqlSReader.Read
AND sqlSReader(0).isDBNull = false THEN") but this didn't work in all
situations.
Would someone have a great solution to this (perhaps a handwritten
function that could do the trick) or some thread or tutorial?
Thanks in advance!

Sascha ([email protected])

P.S. Some questions for future posts:
- is the usage of dots for indentation fine to structure code?
- should I post in another newsgroup? I think that the solution should
be the same to be used for the 1.0 Framework, that's why I've chosen
this group ...
 
Hi Sascha

Did you place this question also in the newsgroup

news://msnews.microsoft.com/microsoft.public.dotnet.framework.compactframework.

It is an active newsgroup with problems like yours.

I hope this helps,

Cor
 
Hi Cor,

thank you for your help!
I already posted in the mentioned newsgroup:
news://msnews.microsoft.com/microsoft.public.dotnet.framework.compactframework.
but I guess it'll take a while to receive an answer...
God, I wish MS would release a new CF Service Pack with the "HasRows"
property for the DataReader object...

Sascha
 
Back
Top