• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 769
  • Last Modified:

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

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
Mike Miller
Asked:
Mike Miller
  • 2
1 Solution
 
David RobitailleAnalyst ProgrammerCommented:
is
for each row as DataRow in datatable.rows
0
 
David RobitailleAnalyst ProgrammerCommented:
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now