Solved

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

Posted on 2014-03-05
1
312 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 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

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 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