Hi:
im developing a
VB.NET web application. i want to creat a count button which will count the total # of records displayed in a datagrid ( the datagrid may be on a number of pages so it should count the total). The code i came up with is as follows:
Dim sqlCount As String
Dim reader As OleDb.OleDbDataReader
Try
sqlCount = "Select count (code) from area"
obj.Query = sqlCount
reader = obj.returnReader
If (IsDBNull(reader.Item(0))) = True Then
lblCount.Text = "0 records returned"
Else
blCount.Text = reader.Item(0) & " records"
End If
Catch exception As Exception
lblCount.Text = "0"
lblComment.Text = "No records returned"
Finally
reader.Close()
it doesnt read the "(If (IsDBNull(reader.Item(0))) = True Then" statement. it jumps to the exception. therefore, i think the problem lies between those lines.
please help.
Thanks