MVC c# 没有为类型“System.Nullable`1[System.Int32]”和“System.Int32”
Entity framework 运用过程中,条件查询时会出现 MVC c# 没有为类型“System.Nullable`1[System.Int32]”和“System.Int32”定义二进制运算符 Equal。
处理方法:int类型进行连接是, 非空和非零的前提下才进行Equal,所以尝试转换成int成功就可以处理掉这个异常。
int UserId ;
if (int.TryParse(Request["UserId"], out UserId))
{
where.Equal("UserId", UserId);
}
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/70853.html
- 上一篇:C#程序,如何有效减少CPU占用率
- 下一篇:C#截取字符串