Linq:如果列名中有空格,DataTable选择不起作用?

8

我想从DataTable中选择行。选择条件包括“and”和列名之间有空格,如下所示:

int distributionLineIdex = import.VendorInvoiceLineDetailTable.Select    
       ("Number='AMEX0311_00011' and Line number='001'").Count();

我收到了以下异常信息:
Syntax error: Missing operand after 'number' operator.

enter image description here 我在这里错过了什么?


整数字段在 SQL 中需要加引号吗? - smartcaveman
2个回答

25

使用

[Line Number] = '001'

相反地


如果列名有任何特殊字符,例如November 23, 2016,该怎么办? - RSB

3

当DataTable中的字段名为数字时,这个也同样适用。此时请使用:

[2] = 7878 AND [6] = 'eee'

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接