Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linq :DataTable select does not work if column name has space in it?

I want to select rows from DataTable. Select criteria includes anding and the columns name have a space b/w them as you can see below:

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

I am getting the following exception :

Syntax error: Missing operand after 'number' operator.

enter image description here What am I missing here ?

like image 486
Gainster Avatar asked May 03 '11 21:05

Gainster


2 Answers

Use

[Line Number] = '001'

instead

like image 97
MartW Avatar answered Oct 21 '22 22:10

MartW


This is also true when the field name in DataTable is numeric. In that case use:

[2] = 7878 AND [6] = 'eee'
like image 32
Tal Avatar answered Oct 21 '22 21:10

Tal