我有一个组合框,其中装有来自选择命令的数据:
OleDbCommand cmd = new OleDbCommand(" select * from m10_NEW where [Unit Description] like '" + tagNameComboBox.Text + "' AND [Frequency] like '31' AND [M10 TYPE] like 'Mechanical' ", con);
当组合框填充诸如Pump's Motor No. 2
之类的数据时,我收到一条错误消息:
查询表达式中的语法错误(缺少运算符)
问题是由于引号'
如何在不更改数据名称的情况下解决此问题?