hello,
Am fetching the data from MS Access database in dataGridview.
I have one button to load the data in table after that I want to select the date from datetimepicker and on selection it should dispaly all the records based on the selection in gridview.I tried this code...
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
DataView dv = new DataView(dt);
DateTime startT = new DateTime();
DateTime endT = new DateTime();
startT = dateTimePicker1.Value.Date; // Ex: 2014-11-24 12:00:00
endT = dateTimePicker1.Value.Date.AddDays(1).AddSeconds(-1); // Ex: 2014-11-24 11:59:59
// dv.RowFilter = string.Format("Select * From CustomerDetails WHERE DATA Between '" + startT + "' AND '" + endT + "'");
dv.RowFilter = string.Format("BookingDate '%{0}%'", dateTimePicker1.Value.ToString());
dataGridView2.DataSource = dv;
//bindingSource1.Filter = string.Format("EventDate = #{0}#",dateTimePicker1.Value.ToLongDateString());
}Thanks,