Solved

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

Posted on 2014-03-05
1
298 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 74

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now