I have the following code in aspx file. I would like to display a message when my query returns 0 rows or null. How can I check this correct since my example does not catch null values.
protected void search_Click(object sender, EventArgs e)
{
string searchItem;
searchItem = "Select * FROM test WHERE (name like '%"+searchTxt.Text.ToString()+"%')";
SqlDataSource.SelectCommand = searchItem;
if (SqlDataSource.SelectCommand == null)
hiddenMsg.Visible = true;
else
SqlDataSource.SelectCommand = searchItem;
}
enjoy