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

13,804

Solution 1

Use

[Line Number] = '001'

instead

Solution 2

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

[2] = 7878 AND [6] = 'eee'
Share:
13,804
Gainster
Author by

Gainster

Updated on June 17, 2022

Comments

  • Gainster
    Gainster almost 2 years

    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 ?

  • RSB
    RSB over 7 years
    What if the column name has any special characters , something like November 23, 2016 ??