How do you use a DataReader in a if statement without

R

Rico Alexander

advancing the record its reading. I'm trying to use a Do While Read() after
a If Dataread statement but its not reading all the records.
 
K

Kevin Spencer

You can't. What you can do is something like the following:

If objDataReader.Read() Then
Do
' some code
While objDataReader.Read()

This advances the DataReader to the first record initially, but performs no
operation with it. The loop advances the DataReader AFTER performing
operations on the current record.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top