我有以下代码:
//myDataTable has the following collumns: UserName, Birthday and email.
string name = "eric!";
string expression = "UserName = " + name;
DataRow[] result = myDataTable.Select(expression);
Run Code Online (Sandbox Code Playgroud)
我想选择所有名称为“ eric!”的行。
“!” 给我以下错误:
无法解释令牌“!”。
如何选择带有此类标记的所有行?
(由于从.sql文件中提取了用户名,因此我确实需要在表达式中加上“!”)