LINQ Query Case Sensitive?

Hey there,

I had an issue with this query. It seems the partNum criterion is case sensitive. As in ABC123 does not equal abc123.

I’ve never run into this before.

The Kinetic forms seem to be bad about not pulling the part number as it is stored in the Part table and storing them that way in the subsidiary tables. But I sure thought the LINQ query would not be case sensitive.

var jobPart_xRow = (from row in dsJobEntry.JobPart 
where row.Company == Session.CompanyID &&
row.JobNum == jobNum &&
row.PartNum == partNum
select row).FirstOrDefault();

This is happening inside a function via a REST call.

A new REST thing, maybe?



== is checking for literal equality between the two strings. You can convert both sides of the comparison to ToUpper() or ToLower(), or use string.Equals() with the
StringComparison.CurrentCultureIgnoreCase parameter.

Using == in a LinqToSql Where clause might behave a little differently since the comparison is being done at the database, depending on the database case sensitivity settings. In your example here it is done in memory.


Cool. Thanks, Andrew.

1 Like