Using a DateTime with SQL ?

  • Thread starter Thread starter Herby
  • Start date Start date
H

Herby

I am using instances of DateTime within my application
and i need their values to be used as selection criteria in an SQL
select clause.

So i need them to return a literal string representation of themselves
in the following format

'{ts '1990-01-01 00:00:00'}'

Where the date can be any valid date as contained in the DataTime
instance.

How can i get them to do this ?
 
Please help im stuck on this?

The database server expects it in the following format
'{ts '1990-01-01 00:00:00'}'


But Datetime does not seem to provide a method to return it in this
universal format.


When i use a DataTime object as a DbParameter - i get similar problems.



Why all these problems with Dates still all the time?
 
I really need some help on this.
My database server will only accept dates in the above format
{ts '1990-01-01 00:00:00'}

How do i get DateTime to return its values in this format?
Its hard for me to believe that something does not already exist to do
this?
I hate to re-invent the wheel.

Or i need confirmation that i need to implment a custom formatter?
If so will DbParameter pick this format up?
 
Back
Top