Retriving data from Ms access table in between two dates by using C#.net

Aug 5 2011 2:34 AM
Dear all,
  Here what i actually need is i want to display the data in between two dates in MS Access table by using OLEDB connection through datagridview.here table name in tokendetails and column name in software_1 createddate.Please help me to write code for this problem.

i wrote code as bellow.

string






da.Fill(ds,
dataGridView1.DataSource = ds.Tables[
st = "select * from tokendetails where software_1createddate between " + DateTime.Parse(DateTime.Today.AddDays(-10ToShortDateString()) + " and " + DateTime.Parse(DateTime.Today.AddDays(-1).ToShortDateString()) + "";MessageBox.Show(st);OleDbDataAdapter da = new OleDbDataAdapter(st, con);DataSet ds = new DataSet();"tokendetails");"tokendetails"];


In between two dates  data available in Table.



but i got error as

Syntax error (missing operator) in query expression 'software_1createddate between 01/07/2011 00:00:00 and 16/07/2011 00:00:00'.

for u r referece i send my application and database file in attachment.pls check at u r end and please suggest me the code.
thanks in advance.

Attachment: vishnu.rar

Answers (7)