[英]Missing operand after 'Operator Name' operator
I am filtering my gridview using dataview. 我正在使用dataview过滤我的gridview。 I am passing the filter command to dataview as mentioned below;
我将filter命令传递到dataview,如下所述;
string strFilter= " 0=0 ";
if (Session["SampleSession"] != null)
{
strFilter= strFilter+ " and Emp Name = '" + Session["SampleSession"].ToString() + "' ";
}
dv.RowFilter = strFilter; // Throws an error here!
It throws an error of Missing operand after 'Operator Name' operator in above line. 在上一行的“ Operator Name”运算符之后,它将引发缺少操作数的错误。
i believe there is small error which i am unable to catch. 我相信有一个我无法捕捉到的小错误。
您的问题是“ Emp名称”(列名称)包含一个空格,需要在过滤器表达式中用方括号括起来:
strFilter= strFilter+ " and [Emp Name] = '" + Session["SampleSession"].ToString() + "' ";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.