Posted By: Dr Herbie | Oct 30th, 2008 @ 5:26 AM
page 1 of 1
Comments: 3 | Views: 1273
Dr Herbie
Dr Herbie
Half the population have below average IQ
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
Roj
Roj
Roj
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
jh71283
jh71283
Throw new System.Beverage. OutOfCoffeeException​()
I was gonna say skip Linq to sql and jump to EF.

Linq to SQL is great, but limited, especially when it comes to schema changes...

page 1 of 1
Comments: 3 | Views: 1273
Microsoft Communities