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.

how can make ignore nulls , still check length? enter image description here

you can try avoid nulls.

results = query.where(p =>      !string.isnullorempty(p.field<string>(array[0]))      &&  p.field<string>(array[0]).length > 10); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -