A1VBCode Forums

Filter Start Date to End date.


http://a1vbcode.com/vbforums/Topic32359.aspx

By bottommy - 1/10/2016

using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM completeup WHERE Date_Time_Down >= @FromDate and Date_Time_Down <= @ToDate", con))

{

using (MySqlDataAdapter da = new MySqlDataAdapter(cmd))

{

cmd.Parameters.AddWithValue("@FromDate", (this.frtxt2a.Text));

cmd.Parameters.AddWithValue("@ToDate", (this.Totxt2a.Text));

excelbtn.Enabled = true;

DataSet ds = new DataSet();

da.Fill(ds);

CmpleHisGV.DataSource = ds;

CmpleHisGV.EmptyDataText = "No Record(s) Found";

CmpleHisGV.DataBind();

}

}
By Mark - 1/11/2016

Are you getting an error or just nothing returned? I would assume when you are adding the date to the parameter you would need to convert the text value to a date value.