Kurt111780
Technical User
I'm trying to query an access database using C# and ASP.Net. I need to compare the access date field with the current date. This is what I came up with but it does not work.
DateTime dteDate = DateTime.Now;
//query database
objCmd = new OleDbCommand ("SELECT * FROM exhibitions WHERE dteEndDate = " + dteDate + " ORDER BY dteEndDate", objConn);
This is the error message:
Syntax error (missing operator) in query expression 'dteEndDate = 2/18/2005 12:45:44 PM'.
How can I compare a date to todays date?
Thanks,
Kurt
DateTime dteDate = DateTime.Now;
//query database
objCmd = new OleDbCommand ("SELECT * FROM exhibitions WHERE dteEndDate = " + dteDate + " ORDER BY dteEndDate", objConn);
This is the error message:
Syntax error (missing operator) in query expression 'dteEndDate = 2/18/2005 12:45:44 PM'.
How can I compare a date to todays date?
Thanks,
Kurt