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

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

问题描述

我正在使用dataview过滤我的gridview.我将过滤器命令传递给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 Emp Name = '" + Session["SampleSession"].ToString() + "' ";
        }
dv.RowFilter = strFilter;  // Throws an error here!

在上一行的"Operator Name"运算符之后引发缺少操作数的错误.

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.

推荐答案

您的问题是"Emp名称"(列名称)包含空格,需要在过滤器表达式中用方括号括起来:

Your problem is that "Emp Name" (the column name) contains a space and needs to be wrapped in square brackets in the filter expression:

strFilter= strFilter+ " and [Emp Name] = '" + Session["SampleSession"].ToString() + "' ";

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

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