在DataTable的.Copy中查询 [英] Filter in A Query in DataTable's .Copy
本文介绍了在DataTable的.Copy中查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请参阅下面的代码:
DataTable dtTemp = dtSource.Select(sFilter).CopyToDataTable();
如果sFilter的值为Category,则为
='公共汽车'或类别='火车'
它是好的
如果sFilter的值是Category ='Bus'+ Category ='Train'
出错:无法对System.Boolean和System.String执行'='操作
请帮助sFilter中出错。我将'+'更改为'&'并得到了同样的错误。谢谢。
if sFilter's value is Category = 'Bus' or Category = 'Train'
it is fine
if sFilter's value is Category = 'Bus' + Category = 'Train'
Got an Error: Cannot perform '=' operation on System.Boolean and System.String
Please help what is wrong in the sFilter. I changed the '+' to '&' and got the same error. Thanks.
推荐答案
使用AND
或或
。
+不受支持。
UseAND
orOR
.
+ is not supported.
这篇关于在DataTable的.Copy中查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文