I recommend writing a generic function that produces the date expression for
the target database.

With MS Access, you can use the DateSerial/TimeSerial functions to build a
safe, non-ambiguous date expression.

Using #<date># in a Jet SQL statement will be interpreted as a US date
format (month/day/year) if possible.  When used in VB/VBA/VBScript(?) code,
AFAIK the DEVELOPER's locale defines the default interpretation.

Function DBSQLDateString(dtDate)
'MS Access Date String with Time of day:
DBSQLDateString = "DateSerial(" & Year(dtDate) & ", " _
        & Month(dtDate) & ", " & Day(dtDate) _
        & ") + TimeSerial(" & Hour(dtDate) & ", " _
        & Minute(dtDate) & ", " & Second(dtDate) & ")"
End Function

When you switch to SQL Server, just modify the function to produce the
appropriate CONVERT() statement with an explicit date format (see a previous
post).

HTH,
Tore.


-----Original Message-----
From: Nick Middleweek [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 02, 2002 11:30 AM
To: ActiveServerPages
Subject: RE: Problems with UPDATE ? - Dates? - FORMATTING?


It's ok, Sorry, I was using ## as the delimiters and not ''. So there's a
problem using ##.

I thought I was using '' but got confused with the UPDATE and INSERT code.

They're both set to use '' now.


Thanks,
Nick


:> -----Original Message-----
:>
:> Do ## date delimiters work on MSSQL?
:>
:> Although I'm using Access now, I might be upgrading to MSSQL in about 3
:> months?
:>
:> I'll give it a go thought, thanks.
:>
:> Nick
:>


---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%

---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to