473,385 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Check for rows in DataReader (CF 1.0)

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
Expand|Select|Wrap|Line Numbers
  1. sqlSCom.CommandText = "SELECT somerows FROM sometable"
  2. sqlSReader = sqlSCom.ExecuteReader
  3. 'Check if one row can be read from the reader
  4. IF sqlSReader.Read THEN
  5. .... 'read in a loop
  6. .... do something
  7. .... WHILE sqlSReader.Read
  8. ....... do something
  9. .... END WHILE
  10. END IF
  11.  
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 (sm****@aspoint.de)

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 ...
Nov 20 '05 #1
2 1012
Cor
Hi Sascha

Did you place this question also in the newsgroup

news://msnews.microsoft.com/microsof...mpactframework.

It is an active newsgroup with problems like yours.

I hope this helps,

Cor
Nov 20 '05 #2
Hi Cor,

thank you for your help!
I already posted in the mentioned newsgroup:
news://msnews.microsoft.com/microsof...mpactframework.

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
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Jacko | last post by:
Hi guys, Say I made a SELECT statement to my sql DB that would return 50 rows that I will use a sqldatareader to access. Instead of iterating through each and every row of the datareader, I'd...
2
by: Andrew | last post by:
Hey all, Have a strange one here, and being still fairly new to .NET isn't helping me understand it. I am having a problem where a DataReader doesn't return all the rows when I try to use a...
3
by: hazz | last post by:
The datareader below contains two rows of two columns but in the for loop, the values for only the first row are getting printed twice. How do I get to the values of the second row? Thanks. -hazz...
6
by: dew | last post by:
How do I get the number of rows a datareader has? I can tell HasRows, but not how many. Thanks.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.