我的DBML公開了一個具有可爲空的nvarchar字段的記錄集。這個可以爲空的nvarchar字段在我的C#代碼中表示爲一個字符串。LINQ to SQL查詢中的String.IsNullOrEmpty?
有時候這個字段是空的,有時它是一個空字符串,有時它實際上有一個值。
String.IsNullOrEmpty()
在LINQ To SQL中工作嗎?例如,將以下工作:
var results = from result in context.Records
where String.IsNullOrEmpty(result.Info) == false
select result;
你可以試試,LinqPad是你的朋友。 (http://www.linqpad.net/) –
重複的http://stackoverflow.com/questions/1368946/linq-syntax-where-string-value-is-not-null-or-empty – hatchet