Gainster
Gainster

Reputation: 5631

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 ?

Upvotes: 9

Views: 17551

Answers (2)

Tal
Tal

Reputation: 31

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

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

Upvotes: 3

MartW
MartW

Reputation: 12538

Use

[Line Number] = '001'

instead

Upvotes: 27

Related Questions