c# - Expression in DataTable -


i have simple code:

    currentdatatable.columns.add("active", type.gettype("system.boolean"));     currentdatatable.columns.add("symbol", type.gettype("system.string"));     currentdatatable.primarykey = new datacolumn[] {currentdatatable.columns[1]};      string filterexpression = "symbol = aaa";     datarow[] existingrows = currentdatatable.select(filterexpression); 

when executing, error: cannot find column [aaa].

what doing wrong??

if want "aaa" interpreted string, use:

string filterexpression = "symbol = 'aaa'"; 

from datacolumn.expression documentation:

when create expression filter, enclose strings single quotation marks:


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -