c#一条简单的SQL插入语句。
c#的windows窗体中,想把 comboBox1.Text,textBox1.Text,textBox2.Text内容插入到表gas_type中。有如下语句:
if (add == 1)
{
SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, "insert into gas_type(paytype,bottletype,money) values('" + comboBox1.Text +"','"+textBox1.Text +"','"+textBox2.Text +"')");
GetUnitInfo();
MessageBox.Show("添加成功!");
add = 0;
}
三个文本框的取值均正确,单独把insert into gas_type(paytype,bottletype,money) values("内部用户",000"","111")放在sql server 企业管理器单独调试的时候,出现错误:sql server在此上下文中不允许出现使用'内部用户',此处只允许使用常量、变量、表达式。不允许使用列名。
请问这是怎们回事啊?
注:(paytype, bottletype, money) 类型均为var 。。。。