Get the number or rows in a table
Hi
Im using an Access database however im unsure on how to loop through every row in the table.
I have the following function, which works great - but as you can see it will only display the first 50 rows in the table. How do i loop through all the rows if i dont know how many rows there are!?
VB Code:
Private Sub printAllRows()
For u As Integer = 0 To 50 Step 1
lbProductData.Items.Add(m_dtProducts.Rows(u)("ProductName").ToString())
Next
End Sub
Thanks, Reeksy.
Re: Get the number or rows in a table
simple....use EOF function...
example:
VB Code:
public function printallrows()
{
while not rst.eof ' uptill end of rows of record set....
msgbox rst(0) ' Print Recordset
rst.movenext ' move to next record
wend
}
try it...hope it will resolve the issue...All the best