Hi,
Try this:
protected void Button1_Click1(object sender, EventArgs e)
{
DateTime dt1 = Convert.ToDateTime(TextBox1.Text);
DateTime dt2 = Convert.ToDateTime(TextBox2.Text);
con.Open();
SqlCommand cmd = new SqlCommand("select 'Ch.No'=SNO,'Date'=DATE,'Particulars'=PNAME,'Qty'=QUANT,'Rate'=RATE,'Amount'=TOTAL,'Balance'=BALANCE from BILL1 where CNAME=@Cname and DATE between @FromDate and @ToDate", con)
cmd.CommandType = CommandType.Text;
cmd.Parameters.add("@Cname", DropDownList1.SelectedItem.Text);
cmd.Parameters.add("@FromDate", dt1);
cmd.Parameters.add("@ToDate", dt2);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
Button3.Visible = true;
}
All the best.
--Amit