Roy,
You don't want to do it like this. Instead, when creating your
SqlCommand instance, use a parameterized query. Your where clause will look
like this:
WHERE datetimecolumn = @datetimevalue
And then you will add the @datetimevalue parameter through the
parameters collection on the command (passing the value you are looking to
insert for that parameter as well).
The provider will do the conversion for you.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Roy" <Ro*@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
>I want to dynamically construct a TSQL with a datetime column in the WHERE
clause. How do I include the millisecond in the query?
"WHERE datetimecolumn = " + dt.ToString() will not include the
millisecond.
Thanks.