I have a DataTable in C# and I am attempting to use LINQ to select rows. The issue I am encountering is that a hyphenated column name is being interpreted incorrectly.
Here is the code:
DataRow[] matches = myTable.Select("SUB-CATEGORY = '" sc "' AND BW = '" bw "'");
I am getting the error "Cannot find the column [SUB]".
How can I resolve this?
CodePudding user response:
Thanks to the comments provided, the solution is as follows:
DataRow[] matches = myTable.Select("[SUB-CATEGORY] = '" sc "' AND BW = '" bw "'");