【发布时间】:2013-02-05 00:38:27
【问题描述】:
我需要填充List<string>,但是当我的查询返回空值时,此列表中不会创建空字符串。
var maskObj = (from m in context.sistema_DocType_Index
join n in context.sistema_Indexes on m.indexId equals n.id
where m.id == docTypeId
select new maskModel
{
mask = n.mask
}).ToList();
return Content(""+maskObj.Count());
如果此查询返回 3 行,并且全部为 NULL,我需要列表中的 3 个空字符串。
有什么办法可以实现吗?
我知道对于 Sql Server,NULL 是没有价值的。即使 NULL == NULL 也返回 false,那我该如何继续呢?
【问题讨论】:
-
添加'where n.mask is not null'怎么样?
标签: c# sql-server entity-framework