False While Statement

G

Guest

I have the following while statement in my code

While dataReader.read(
‘Do Stuffâ€
End Whil

The dataReader contains 19 rows of data, but the while loop continues and fails on a 20th loop. I have attached a debugger and watched the value of dataReader.read go from True to False after the 19th loop. For some strange reason the loop continues after "While dataReader.read" becomes false

Any fixes, tips, or suggestions are greatly appreciated

Ty Millwe
(e-mail address removed)

--Actual Code-

Dim dr2 As SqlDataReade
dr2 = SqlHelper.ExecuteReader(oConn, CommandType.Text, sql

While dr2.Rea

If Not IsDBNull(dr2("hpa")) The
Me.dg.Items.Item(i).Cells(5).Text = CStr(dr2("hpa")
Els
Me.dg.Items.Item(i).Cells(5).Text = Nothin
End I

If Not IsDBNull(dr2("comments")) The
Me.dg.Items.Item(i).Cells(9).Text = CStr(dr2("comments")
Els
Me.dg.Items.Item(i).Cells(9).Text = Nothin
End I

CalcHLP(i
CalcATL(i
'CalcHB(i
i = i +
End Whil
 
G

Guest

How about slightly changing the code like this

Do While datareader.read(
' do somethin
End While
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top