Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not like in LINQ to SQL

Tags:

c#

linq-to-sql

I have to select data from database using LINQ to SQL. There is a condition that i should select only record with ID not containing "0000" at begin ( whole ID number have six digits).

For example when I would want to select data starting with "0000" I will use:

var idList = (from s
    in db.TABLE
    where s.ID.StartsWith("0000")
    select s.ID
    );

but I need to use method more like NotStartsWith or NotContains instead of StartsWith. Is that possible?

like image 656
zgorawski Avatar asked Jan 12 '11 14:01

zgorawski


1 Answers

Have you tried !s.ID.StartsWith("0000")? (i.e. using the negation operator !)

like image 133
Hosam Aly Avatar answered Nov 04 '22 05:11

Hosam Aly