Select a record at a particular date from Access database using C#.net Code

Aug 13 2009 4:55 AM

hai...Plz hep me...
I want to retrieve a row at a particular date from access database using c# code..
I was using the following code..An exception occured as DATA TYPE MISMATCH IN CRITERIA EXPRESSION..
OleDbDataAdapter ad = new OleDbDataAdapter("select * from schedule where listdate='"+dateTimePicker1.Value.ToShortDateString()+"'", con);
DataSet ds = new DataSet();
ad.Fill(ds,
"schedule");
if (ds.Tables[0].Rows.Count > 0)
{
scheduleDataGridView.DataSource = ds;
scheduleDataGridView.DataMember = ds.Tables[0].ToString();
}
 
 
 
Please help me.............Thanks in Advance.....

Answers (6)