formatting a date CString



I have a date/time string in the form "2006-09-25 23:59:59" that I need
to save to a database column. The schema describes the column as a DATE
data type (Otacle). I'm using a CString.Format() method to build the SQL
INSERT statement.

If I format the string as text with single quotes '%s' the Oracle driver
says bad format. If I leave the quotes off, the whitespace in the middle
looks like 2 parameters.

I'd like to avoid invoking any date conversions that might be database
specific, as the database could be Access or SQL Server someday.

What to do?
.



Relevant Pages

  • Re: Need a Strategy to store the Single Quotes in the Database
    ... >> Database where if i try to Store the String value with Single Quotes ... >> then it is throwing the error as SQL String Truncated. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Database for a WM5 device
    ... You suggestion of the single quotes wasn't it. ... After doing that I am able to run my SQL CE commands in my VB.NET program ... It sounds like I can use SQL CE on my WM5 device. ... CE database on the desktop. ...
    (microsoft.public.pocketpc.developer)
  • Re: Need a Strategy to store the Single Quotes in the Database
    ... Database where if i try to Store the String value with Single Quotes then it is throwing the error as SQL String Truncated. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: SQL Question
    ... This will go through since the single quotes are passed on literally ... to the database while the double ... part of format function will be resolved by VB... ... The first and third DatePart are being passed to SQL; ...
    (microsoft.public.vb.general.discussion)
  • Re: Sql insert Question
    ... What you are seeing is a classic example of a vulnerability to a SQL ... Obviously you want to fix this here, ... If your database doesn't support parameterized stored procedures or you ... quote with two single quotes (not double quotes but literally two ...
    (microsoft.public.dotnet.framework.aspnet)

Quantcast