Solved

Do While EOF or For/Next based on query results VB.NET

Posted on 2009-04-01
3
750 Views
Last Modified: 2013-11-26
I want to query an SQL database and then do something based on each record found.

For (each record)
'do something
Next

or maybe

Do While (not EOF)
'do something
Loop

How would I do this?

(vb.net only please)
0
Comment
Question by:mwmiller78
  • 2
3 Comments
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24041003
is
for each row as DataRow in datatable.rows
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24041025
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 24041089
Try this way:



Using reader As SqlDataReader = command.ExecuteReader() 

   While reader.Read()

        ' your code

   End While 

End Using 

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now