On Fri, 01 Jul 2005 14:26:37 GMT, "Dave" <(E-Mail Removed)> wrote:
¤
¤ "Paul Clement" <(E-Mail Removed)> wrote in message
¤ news:(E-Mail Removed)...
¤ > On Thu, 30 Jun 2005 18:53:27 GMT, "Dave" <(E-Mail Removed)> wrote:
¤ >
¤ > ¤ Hi,
¤ > ¤
¤ > ¤ Whats the best way of handling dates gathered from the OS (e.g. using
¤ > ¤ DateTime.Now or SqlDateTime) and using it in a SQL query? I want to
¤ > create
¤ > ¤ a culture neutral string so that a SQL server will process the date no
¤ > ¤ matter of the language or database settings.
¤ > ¤
¤ > ¤ Overloading DateTime.ToString with "s" seems to produce a date that SQL
¤ > ¤ processes regardless of the original date format or OS settings, but
¤ > there
¤ > ¤ is no equivalant overload with SqlDateTime.
¤ > ¤
¤ > ¤ How do most people handle this and avoid the error "Syntax error
¤ > converting
¤ > ¤ datetime from character string"?
¤ >
¤ > Are you using a stored procedure with parameters?
¤ >
¤ >
¤ > Paul
¤ > ~~~~
¤ > Microsoft MVP (Visual Basic)
¤
¤ No, just using a SqlDataAdapter and doing SQL queries directly.....
¤
Then you're pretty much at the mercy of the database implementation. It's much easier to work with
dates in their native format than converting from a string value.
Paul
~~~~
Microsoft MVP (Visual Basic)
|