Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-04-01
3
Medium Priority
?
762 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

715 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