i wrote a code where the number is in the db then show the info in gridview when i give valid number it is showing only fields when i give invalid it says no record found in gridview i have used EmptyDataText tag
why is the record not showing
- SqlConnection con = new SqlConnection(pps);
- con.Open();
- SqlCommand cmd = new SqlCommand();
- String sqlquery = "SELECT [ProjectID], [ProjectTitle] FROM [ProjectDetails] where [UserID] like '%'+@userid+'%'";
- cmd.CommandText = sqlquery;
- cmd.Connection = con;
- cmd.Parameters.AddWithValue("userid", txtempsearch.Text);
- DataTable dt = new DataTable();
- SqlDataAdapter sda = new SqlDataAdapter(cmd);
- sda.Fill(dt);
- GridVSearch.DataSource = dt;
- GridVSearch.DataBind();