I have an issue with my first attempt at Linq to SQL: setting DateTime parameters is causing the SQL to fail with :
'Msg 241, Level 16, State 1, Line 3
Conversion failed when converting date and/or time from character string.'
Because the parameter passed out by Linq to SQL is in the format '2008-10-30 12:09:48.0800000' and my SQL Server 2008 choked on that many decimal places for the time. Changing the time (manually) to '2008-10-30 12:09:48.080' works.
So: how is the formatting controlled (on SQL Server 2008 and in Linq to SQL in C#)?
Herbie
-
-
I believe you have to use the new SQL Server 2008 DATETIME2 data type which supports a larger precision, 00:00:00 through 23:59:59.9999999.
Roj -
OK, a moot point now that Linq to SQL is effectively sidelined by Microsoft so I won't be pitting any more effort into trying it out ... Entity Framework, here I come!Roj said:I believe you have to use the new SQL Server 2008 DATETIME2 data type which supports a larger precision, 00:00:00 through 23:59:59.9999999.
Roj
Herbie
-
I was gonna say skip Linq to sql and jump to EF.Dr Herbie said:
OK, a moot point now that Linq to SQL is effectively sidelined by Microsoft so I won't be pitting any more effort into trying it out ... Entity Framework, here I come!Roj said:*snip*
Herbie
Linq to SQL is great, but limited, especially when it comes to schema changes...
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.