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
Post a Comment