VB.net and SQL query on date field
412980Jan 20 2004 — edited Jan 21 2004I have a sql query that compares date on Oracle. The field is defined as Date type in Oracle and format is mm/dd/yyyy. My date format in VB is mm/ddd/yyyy. In my VB code I want to select reords that are older than 5 days. Here is the VB code:
Dim DateBack As Date
DateBack = DateAdd("d", -5, Today)
SqlString = "Select * from PIF_Table"
SqlString = SqlString & " WHERE marketingsignaturedate<'" & DateBack & "'"
When I execute the code I get an OleDb error like:
An unhandled exception of Type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
My code works fine selecting other fields that are not defined as Date type. Any help is highly appreciated. Thank you.