I have a piece of code:
var component = (from components in dataContext.Component select components)
.Where(x => x.Name.ToString().Equals(componentCode));
where Component
is very simple object.
In mysql database table (encoded in utf8 - utf8_unicode_ci)
I have record such as: szkło 3mm (with polish character ł).
When I'm trying to find this record with the code above I get nothing.
Records without polish characters works fine.But when I'm doing it with foreach
I get the result:
var component = (from components in dataContext.Component select components);
foreach(Component comp in component)
{
if (comp.Name.ToString().Equals(componentCode))
componentPrice = (decimal)comp.Price;
}
Is there a way to get the result with just a linq code without iterating through table.?