'&'之前缺少操作数运营商。 [英] Missing operand before '&' operator.

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

问题描述

当我查询这样的数据表时



DataRow [] dr = dtRec.Select(Priority ='3'&& Recommendations ='Replace Motor Bearings' );



我收到一个错误,例如exception = {语法错误:'&'运算符之前缺少操作数。}

解决方案

&&适用于C语言,但不适用于SQL。对于Select方法,您必须使用SQL语法,因此替换&&与AND ...

 DataRow [] dr = dtRec.Select( 优先级='3'和推荐='更换电机轴承'); 


您好,

从查询中删除'&&'并将其值替换为'AND'。

试试这个

 DataRow []博士= dtRec.Select(Priority ='3'AND Recommendations ='Replace Motor Bearings'); 



更多细节请检查DataTable.Select Method



谢谢


When i am querying a datatable like this

DataRow[] dr = dtRec.Select("Priority ='3' && Recommendations='Replace Motor Bearings'");

I am getting an error like exception = {"Syntax error: Missing operand before '&' operator."}

解决方案

&& is good for C like languages but not for SQL. For Select method you have to use SQL syntax and therefor replace && with AND...

DataRow[] dr = dtRec.Select("Priority ='3' AND Recommendations='Replace Motor Bearings'");


Hello ,
Remove '&&' from the query and replace its value by 'AND'.
Try this

DataRow[] dr = dtRec.Select("Priority ='3' AND Recommendations='Replace Motor Bearings'");


for more details check this DataTable.Select Method

thanks


这篇关于'&'之前缺少操作数运营商。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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