Click here to Skip to main content
15,896,409 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i m trying to featch record on the bases of datetimepicker value but i m getting error
the error Data type mismatch in criteria expression. Please Help me
VB
con.Open();
          OleDbDataAdapter a = new OleDbDataAdapter("select * from data where date_of_complaint=" + dateTimePicker3.Value.Date + ";", con);
          DataTable t = new DataTable();
          a.Fill(t);
          dataGridView1.DataSource = t;
          con.Close();
Posted
Updated 20-Oct-12 20:31pm
v2

1 solution

I have always found when working with dates in dbs the east thing to do is convert your datetime to a string with format "DD-MMM-YYYY" to remove any ambiguity over mm-dd or dd-mm localizations.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900