Remember how you would use:
So as not to crash your program you jump out of the procedure and none of the code gets executed.
It seems as though this doesn't work in .NET. If there are no records it goes ahead and tries to execute the rest of the Sub and goes right ahead and crashes your program, showing that ugly error message that the user doesn't understand anyway. (unless you put On Error Resume Next)
In the following section of code...
I could test for 0 number of rows in the DataSet checking numrows = dt.Rows.Count, then if there were no records, I could display a message somewhere and jump out of the Sub so as not to crash the page.
Problem is that when I get to this line it crashes any way since there are no records. How do I get around this problem since there is no way of checking for end of file?
Thanks.
dpdoug
Code:
if rs.EOF Then
MsgBox "No records found..."
Exit Sub 'jump out
End If
It seems as though this doesn't work in .NET. If there are no records it goes ahead and tries to execute the rest of the Sub and goes right ahead and crashes your program, showing that ugly error message that the user doesn't understand anyway. (unless you put On Error Resume Next)
In the following section of code...
Code:
ds = New DataSet()
cmd.Fill(ds)
dt = New DataTable()
dt = ds.Tables(0)
numrows = dt.Rows.Count
I could test for 0 number of rows in the DataSet checking numrows = dt.Rows.Count, then if there were no records, I could display a message somewhere and jump out of the Sub so as not to crash the page.
Problem is that when I get to this line it crashes any way since there are no records. How do I get around this problem since there is no way of checking for end of file?
Thanks.
dpdoug