Using .net Datetime in sql query

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-03-31T11:57:28Z Indexed on 2010/03/31 12:03 UTC
Read the original article Hit count: 348

Filed under:
|
|
|
|

I have a DateTime object I want to compare against an sql datetime field in a where clause. I'm currently using:

"where (convert( dateTime, '" & datetimeVariable.ToString & "',103) <= DatetimeField)"

But I believe datetimeVariable.ToString will return a different value depending on the culture where the system is running.

How would you handle this so it is culture independent?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#