LINQ to SQL and Null strings, how do I use Contains?

前端 未结 9 999
别那么骄傲
别那么骄傲 2020-12-14 01:23

Here is the query

from a in this._addresses
where a.Street.Contains(street) || a.StreetAdditional.Contains(streetAdditional)
select a).ToList
(
9条回答
  •  粉色の甜心
    2020-12-14 02:00

    I don't think SqlServer gave you a null exception. If it did, then this code is clearly not running though LinqToSql (as you've tagged the question).

    string.Contains would be translated to sql's like, which has no trouble at all with null values.

提交回复
热议问题