日期:2014-05-20  浏览次数:20886 次

linq char 字符串的长度只能为一个字符
我在SQL 2005中数据字段back_ind类型是VARCHAR(1)
linq如下:
var list = from sf in objDataContext.SystemFunction
           where (sf.parent_fun_id == parentId || sf.parent_fun_id == null)
           && sf.back_ind.Equals(backind)
           select sf;

为什么总报“字符串的长度只能为一个字符”错误?
backind这个参数我换成int/string/char类型都试了,总是报错

------解决方案--------------------
var list = from sf in objDataContext.SystemFunction
           where (sf.parent_fun_id == parentId 
------解决方案--------------------
 sf.parent_fun_id == null)
           && string.compare(sf.back_ind,backind)==0)
           select sf;


sf.back_ind,backind  -->都是varchar类型