Solved

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

Posted on 2009-04-01
3
756 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:Mike Miller
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
asp.net mvc 2 32
.NET Enums [Flags] & Bitwise Design Question 6 39
Include MS Database in Winforms Project using Intellilock 5 21
Aspx calendar pop up control 3 25
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

735 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