【发布时间】:2011-05-04 10:00:52
【问题描述】:
我有一个 linq 查询,我想在数据库字段中包含那些不为空或为空的记录,但是当我使用 string.isNullorEmpty 时,它给了我错误。我怎样才能完成这个任务我的查询是
from post in PostIdPostMeta1
join pstmt in postrepository.GetAllPostMetas() on post.int_PostId equals pstmt.int_PostId
where string.IsNullOrEmpty(pstmt.vcr_MetaValue) == false
select post
如果我将 string.IsNullOrEmpty(pstmt.vcr_MetaValue) == false 更改为 pstmt.vcr_MetaValue != string.Empty 它会给我 SQL Server 没有处理 NText、Text、Xml 或 Image 数据类型的比较错误
【问题讨论】:
-
Boolean IsNullOrEmpty(System.String)' 不支持对 SQL 的转换