View Single Post
  #5 (permalink)  
Old July 25th, 2007, 12:20 AM
GeertVerhoeven GeertVerhoeven is offline
Authorized User
Join Date: Sep 2004
Location: Edegem, Antwerpen, Belgium.
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts

There are two possibilities to solve this:

1. Use the TO_DATE function (not preferred method)
... WHERE START_DATE >= TO_DATE({0}, 'YYYYMMDD')", sdate.ToString("yyyyMMdd");

2. Use an OracleCommand object and add Parameters to it. By setting the parameter type to datetime, you are sure that the correct format is used.

On my blog, I created an entry which also uses Parameters and explains the advantages:

The same works for Oracle but then you need to use the classes from System.Data.Oracle or the Oracle specific classes in Oracle.DataAccess.Client ( The last one is optimized but need to be installed separately.


Reply With Quote