Print Page | Close Window

The argument types 'Edm.Decimal' and 'Edm.Double' are incompatible for this operation??

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1754
Printed Date: 26-Apr-2024 at 6:07am


Topic: The argument types 'Edm.Decimal' and 'Edm.Double' are incompatible for this operation??
Posted By: *Calsy
Subject: The argument types 'Edm.Decimal' and 'Edm.Double' are incompatible for this operation??
Date Posted: 26-Apr-2010 at 5:16pm
Hi, getting the following error when executing a PassthruEsqlQuery:
 
*****************
Caught exception: System.Data.EntitySqlException: The argument types 'Edm.Decimal' and 'Edm.Double' are incompatible for this operation. Near greater than expression, line 1, column 264. at
*****************
 
Here is the query being executed (taken from the log file):
 
*****************
Fetch ... PassthruEsqlQuery: [vwSearchParent] Esql: SELECT Value SearchParent From vwSearchParents as SearchParent Where SearchParent.UserGenreID In (Select Value c.UserGenreID From vwSearchChilds As c WHERE c.UserID <> 27 AND ( c.Field1 LIKE '%a%' ) AND c.Longitude > 151.04 AND c.Longitude < 155.36 AND c.Latitude > -29.43 AND c.Latitude < -25.60)
*****************
 
I can execute the exact same query at the server without error. And also it seem that if i apply the same filtering via an entityquery and execute the entityquery it works without issue.
 
Any help on why this error is occurring with the PassThruEsqlQuery?
 
Thanks



Replies:
Posted By: *Calsy
Date Posted: 28-Apr-2010 at 1:26pm
Any ideas?


Posted By: ting
Date Posted: 29-Apr-2010 at 4:56pm
I believe the issue is that you need to specify a decimal type for the numeric literals.  In other words, add 'M' after the number.  For example:
c.Longitude > 151.04M
 
Otherwise it treats 151.04 as a double and throws an exception alerting you of a possible information loss due to type precision.
 
Julie Lerman has a good post covering this:
http://thedatafarm.com/blog/data-access/querying-literals-in-entity-sql - http://thedatafarm.com/blog/data-access/querying-literals-in-entity-sql
 


Posted By: *Calsy
Date Posted: 29-Apr-2010 at 6:35pm
Thanks. Worked a treat.



Print Page | Close Window