How to display 'Empty data' when fill datase
I am working on a VS2005/ASPnet 2.0 website. For a Sub BindDataGrid coding, I have coded the following lines to fill the dataset (ApptsDS)
for a GridView. These codes seem to be working fine if the dataset is not empty. Once in a while, the website stopped and we had an error
message for 'Timeout' server error.
1. How do I code to display a message indicating that 'currently there is no data available' when the dataset is empty? so that the website
keeps running.
2. Is oErr.Message defined by VS2005 ASPnet 2.0? I don't remember how I got this code.
TIA,
Jeffrey
************************************************** ***************************
Dim DAAppts As New SqlDataAdapter(sSQL, oConnect)
Try
DAAppts.Fill(ApptsDS)
gvAppts.DataSource = ApptsDS
gvAppts.DataBind()
Catch oErr As Exception
lblErr.Text &= oErr.Message & "<br />"
Finally
If oConnect.State <> ConnectionState.Closed Then
oConnect.Close()
End If
End Try
C. Jeffrey Wang
__________________
C. Jeffrey Wang
|