Solved

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

Posted on 2009-04-01
3
751 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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…

920 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

17 Experts available now in Live!

Get 1:1 Help Now