On the page, I have only textbox,button,gridview and a label.
I write username to textbox and click button, so it searches in db and fills gridview and update label text as "xx result found" so xx is the count of results found in db.
the sample code is very short and easy:
string userName = TextBox2.Text;
SqlDataSource1.SelectCommand = "Select * From SampleTable Where name = '"+userName+"'";
ResultLable.Text = GridView1.Rows.Count + " Result Found";
GridView1.Visible = true;
ResultLable.Visible = true;
after set SelectCommand you need to call