Linq statement _MyList .Where(c => c.ListItem.Contains(txt.Text)); generates invalid sql like syntax

Posted on 2013-05-29
Medium Priority
Last Modified: 2013-06-25
I am running code like the code below to filter my results in _MyList, this code has ran for ages without any problems but it is now not working for some reason. I had a look at the sql that is being generated and it is building an invalid where clause like this

Result of sql generated from linq code
WHERE [t].[MyColumn] LIKE %12345%

Here is the linq code
_MyList = _MyList .Where(c => c.ListItem.Contains(txt.Text));

Be very grateful for your help.
Question by:jazz__man
LVL 71

Assisted Solution

by:Éric Moreau
Éric Moreau earned 1000 total points
ID: 39204216
Is tour column of a numeric datatype? Have You tried to Cast with a .tostring?

Accepted Solution

sarabhai earned 1000 total points
ID: 39204473

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

600 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