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
Default

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: http://geertverhoeven.blogspot.com/2...-by-using.html

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 (http://download-east.oracle.com/docs...meterClass.htm). The last one is optimized but need to be installed separately.

Greetz,

Geert

http://geertverhoeven.blogspot.com
Reply With Quote