Yogesh Vedpathak

Yogesh Vedpathak

  • 670
  • 1.4k
  • 197.7k

Search Is Not Working Getting Error ...

Apr 2 2018 6:54 AM
Error as Follows: System.Web.HttpException: A field or property with the name 'RequestID' was not found on the selected data source.
 
public DataSet Bind()
{
SqlConnection con = new SqlConnection(connectString);
sqlCon = new SqlConnection(connectString);
SqlCommand cmd = new SqlCommand("select * from tbl_usermaster where UserName like'" + TextBox1.Text + "%'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
da.Fill(ds);
if (!object.Equals(ds, null))
{
if (ds.Tables[0].Rows.Count != 0)
{
// cmd.ExecuteReader();
gv_calllist.DataSource = ds;
// gv_calllist.DataSource = ds.Tables[0];
gv_calllist.DataBind();
}
}
return ds;
}
 
protected void Button1_Click(object sender, EventArgs e)
{
DataSet ds = Bind();
if (!object.Equals(ds, null))
{
if (ds.Tables[0].Rows.Count > 0)
{
gv_calllist.Visible = true;
TextBox1.Text = " ";
Label2.Text = " ";
}
else
{
gv_calllist.Visible = false;
Label2.Visible = true;
Label2.Text = "not available in the record";
}
}
}
 
 
 

Answers (1)