Home Dashboard Directory Help
Search

OverflowException when querying decimal (38, 0) through LINQ To SQL by JensS


Status: 

Closed
 as External Help for as External


8
0
Sign in
to vote
Type: Bug
ID: 316993
Opened: 12/12/2007 12:26:22 AM
Access Restriction: Public
0
Workaround(s)
view
3
User(s) can reproduce this bug

Description

When querying a field through LINQ To SQL that is a decimal (38,0) in a SQL table, we get an OverflowException. This is most likely caused by the already recorded bug 96538.
Details
Sign in to post a comment.
Posted by Microsoft on 10/17/2008 at 3:01 AM
In addition, we have added this to the internal list of suggestions that we track for future versions, in case can find an acceptable workaround.

Thanks again,
LINQ to SQL Team
Posted by Microsoft on 10/17/2008 at 2:58 AM
Hi,

Thanks again for posting this. We are aware that the matching between the type systems is not perfect. We have analyzed this case, and have determined that we cannot handle this case in a special way in LINQ to SQL without negatively affecting the behavior of the great majority of cases in which decimal is a good fit for the server type.

Thanks,
LINQ to SQL Team
Posted by JensS on 5/19/2008 at 2:44 AM
I see that the bug was closed on may 14th without any explanation. As I don't know why the bug was closed and since the problem still is not fixed (even if the fix would be in VS.NET 2008 SP1, that is still in beta) I'm reopening it again.
Posted by JensS on 3/5/2008 at 5:34 AM
So after providing me with the info that I have knwo for quite some time, what are you guys going to do aboout it ?
If you'de look at the comments of bug 96538, you'd see that MS has been dancign around this problem at least since 08 Jan 2004 (which means more than 4 years). Don't you guys think it might be time to actually try to do something about this ?
When creating the mapping you guys could inspect the definition of the field and make LINQ map to a double instead of decimal.
Anyway, I don't care how you do it, but please, FIX THIS.
Posted by Microsoft on 2/15/2008 at 11:35 AM
Hi,

This is a bit unfortunate - but the behavior here is the result of the fact that the CLR Decimal type doesn't support enough precision to be able to handle everything that the SQL Decimal type can support. The maximum precision that is supported for mapping is DECIMAL(29).

You can do manual cast to a Double to go bigger when querying - but you will probably run into other issues because of the fact that there isn't perfect fidelity between the two type systems here.

LINQ to SQL Team
Posted by Microsoft on 12/12/2007 at 10:52 PM
Thanks for your feedback.

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.
These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team
Posted by Microsoft on 12/12/2007 at 5:39 PM
Thank you for your feedback. We are currently investigating. The investigation process normally takes 7-14 days. If this issue is urgent, please contact support directly (see http://support.microsoft.com).

If at any time your issue is closed unsatisfactorily, you may edit your issue via Connect and change the status to “Active.”

Thank you,
Visual Studio Product Team
Sign in to post a workaround.