This is my code .aspx.cs page\[code\]public string makequery(){ string query = string.Empty; if (ddlPortal2.SelectedValue =http://stackoverflow.com/questions/15829079/="Select" && tbFrom.Text == null && tbTo.Text == null && ddlQuery.SelectedValue =http://stackoverflow.com/questions/15829079/="Select") { query = "SELECT * FROM Form3 and ORDER BY CONVERT(VARCHAR(25), [Datetime], 101) between '" + tbFrom.Text + "' and '" + tbTo.Text + "' DESC"; return query; } else if(ddlPortal2.SelectedItem.Text!="Select" && tbFrom.Text!=null && tbTo.Text!=null && ddlQuery.SelectedItem.Text=="Select") { query = "Select * from Form3 where Portal='" + ddlPortal2.SelectedValue + "' and ORDER BY CONVERT(VARCHAR(25), [Datetime], 101) between '" + tbFrom.Text + "' and '" + tbTo.Text + "' DESC"; return query; } else if (ddlPortal2.SelectedItem.Text != "Select" && tbFrom.Text == null && tbTo.Text == null && ddlQuery.SelectedItem.Text != "Select") { query = "Select * from Form3 where Portal='" + ddlPortal2.SelectedValue + "' and ORDER BY CONVERT(VARCHAR(25), [Datetime], 101) between '" + tbFrom.Text + "' and '" + tbTo.Text + "' DESC"; return query; } return null;}public void GridViewBind(){ string query = makequery(); DataSet ds = new DataSet(); if (ds != null) { if (ds.Tables[0].Rows.Count != 0) { GridView1.DataSource = ds; GridView1.DataBind(); } else { GridView1.DataSource = null; GridView1.DataBind(); } }}protected void btnSearch_Click(object sender, EventArgs e){ this.GridViewBind();}\[/code\]}Now here I make two function one to make query and second to bind that query with \[code\]dataset\[/code\] with \[code\]gridview\[/code\] when I bind \[code\]dataset\[/code\] Cannot find table 0. what I want is when I select field and press search button I can view details in my grid according to the selected fields but I can't bind it with my \[code\]dataset\[/code\]. Can you guys help me with this.