My below codes in a button click event
populate data in the grid upon the user click the button.
1. How do I know that my commandtext did not find any matching data to popup the message to the user - No Records found.
2. How do I clear the data in the grid before executing the below codes.
--conection to SQL Server is opened
myadaptor.SelectCommand = New SqlCommand myadaptor.SelectCommand.Connection = myconection myadaptor.SelectCommand.CommandText = “--- select ..... where code = .... ---” myadaptor.SelectCommand.CommandType = CommandType.Text myadaptor.Fill(mydataset, "salesdb") grdlocation.DataSource = mydataset grdlocation.DataMember = "salesdb"