Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Comparing a hex to a string in Linq to Entities query expression

Posted on 2014-03-05
1
Medium Priority
?
342 Views
Last Modified: 2016-02-10
mch.Machine_ID  is the hex value and mId is the string value.

How do I compare a Hex value to a string in LINQ to Entities Query string below?

var loc1 = (from mch in CRMEDM.edm1.m_Location
                         where mch.Machine_ID.ToString() == mId
                         select mch).ToList();

My error message: LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
0
Comment
Question by:metro156
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 1500 total points
ID: 39906672
What do you mean by "hex value"? A hexadecimal value is just a number, represented in a different base. If you're storing it as a number, then you should be comparing two numbers; otherwise, if you have this encoded as a hexadecimal string, then you should be able to do simple string comparison.
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question