3
Answers

How to perform case-sensitive query with LINQ?

Ask a question
Ivica Basic

Ivica Basic

14y
10k
1

I'm using C# in VisualStudio 2008 for database Windows application. I've got connection "db" to local database. Database contained table "tblBib" with string-type column "Redak". I want to query this table and get out all rows in which column "Redak" contains substring "Adams", but I don't want rows with substring "adams" or "aDams". I want case sensitive search.

I've tried this:

var linqUpit =

                    from redovi in db.tblBib

                    where redovi.Redak.Contains("Adams")

                    select redovi;

but this code gives back "Adams" and "adams" and "aDams".

What's missing?

Thanks.


Answers (3)