'Operator Name'运算符后缺少操作数? [英] Missing operand after 'Operator Name' operator?

查看:67
本文介绍了'Operator Name'运算符后缺少操作数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用dataview过滤我的gridview.我将filter命令传递到dataview,如下所述;

I am filtering my gridview using dataview. I am passing the filter command to dataview as mentioned below;

string strFilter= " 0=0 ";  
  
if (Session["SampleSession"] != null)     
{       
  strFilter= strFilter+ " and EmpName = '" + Session["SampleSession"].ToString() + "'";     
} 
  
dv.RowFilter = strFilter;  // Throws an error here!



在上面的行中的运算符名称"运算符之后,它将引发缺少操作数的错误.

我相信有一个我无法捕捉到的小错误.

请指导我!



It throws an error of Missing operand after ''Operator Name'' operator in above line.

I believe there is small error which i am unable to catch.

Please guide me!

推荐答案

尝试在strFilter子句中使用@指令.
Try using the @ directive in the strFilter clause.
string strFilter= @" 0=0 "; 
if (Session["SampleSession"] != null)     
{       
  strFilter= strFilter+ @" and EmpName = ''" + Session["SampleSession"].ToString() + "'' ";     
} 


''Operator Name''来自何处?很好地调试您的代码.您将附加到strFilter.该语句之前和之后的strFilter值是什么.如果无法解决问题,请在此处发布这些值.
Where ''Operator Name'' comes from? Debug your code well. You are appending to strFilter. What is the value of strFilter before and after that statement. If you cannot get the problem, post those values here.


这篇关于'Operator Name'运算符后缺少操作数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆