Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 767
  • 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
 
jpaulinoCommented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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