c# - LINQ to SQL - Checking the field length -
i getting rows access db. need check fields length. got work, problem if field comes null. check fails. how made check length (array[0] column name checked), , works:
results = query.where(p => p.field<string>(array[0]).length > 10);
now problem if field null. screen shot displays field coming empty , fails check. field number 25.
you can try avoid nulls.
results = query.where(p => !string.isnullorempty(p.field<string>(array[0])) && p.field<string>(array[0]).length > 10);
Comments
Post a Comment