今天写一个C#访问Access的程序,拼接SQL语句时一直出错,
string sql = "insert into dllinfos (dllname,dllfilename,type,functions,harm,repairmethod,issys, paths, ishorse, language, version, company) values ('" + textBox1.Text + "','" + textBox2.Text + "','" +
textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" +
textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "','" + textBox11.Text + "','" + textBox12.Text +
"');";
查了很久;
原来 language 应该是Access或一些数据库的一个保留关键字,不能直接用作字段名;
改为 mylanguage 之类即可;
修改字段名,