Display Message If RS Is Empty

Results 1 to 2 of 2

Thread: Display Message If RS Is Empty

  1. #1
    Join Date
    Dec 1969

    Default Display Message If RS Is Empty

    I have a web service sending data to my datagrid. Currently if I look up a value that has no record in the database I recieve no message. I would like to make the application display a message like "No records were found." Here&#039;s my code, <BR><BR>Sub Button1_Click(sender As Object, e As EventArgs)<BR>Dim employeeID As String<BR>employeeID = Trim(TextBox1.Text)<BR>&#039;Declaration format: Dim variablename As New Namespace.Class<BR>Dim wsProxy As New EmployeeInfo.Employee()<BR><BR>DataGrid1.DataSourc e = wsProxy.GetEmployeeInfoEmployeeNumber(employeeID)< BR>DataGrid1.DataBind()<BR>End Sub<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Display Message If RS Is Empty

    Instead of setting the function equal to the datasource put it into another object first and check the count of that object. Then if the count is &#062; 0 set the datasource to the object you just created and do your databind. Else display the message.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts