I am trying to fetch the matching database attribute from textbox
text and display the related database in GridView
. What am I doing wrong here?
protected void btnsearch_Click(object sender, EventArgs e)
{
string q = "Select * from facultyreg where fname ='"+txtsearch.Text.ToString() + "'";
sda = new SqlDataAdapter(q, con);
ds = new DataSet();
sda.Fill(ds, "facultyreg");
GridView2.DataSource = null;
//GridView2.DataBind();
GridView2.DataSource=ds.Tables[0];
/* cmd = new SqlCommand(q,con);
if (sdr.HasRows && sdr != null)
{
sdr.Read();
}*/
}