sql语句代码是这个
sql="INSERT INTO "+table+" ("; for(int i=0;i<num;i++){ sql +="'"+Field[i]+"'"; if(i!=num-1) sql+=","; } sql+=") VALUES ("; for(int i=0;i<num;i++){ sql +="'"+Cont[i]+"'"; if(i!=num-1) sql+=","; } sql+=");";
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''TeachID','WorkName','WorkLoad')VALUES('000002','课程设计','120')' at line 1
请问这里是什么错误,看不出来
解决方案
将第一个for中的 sql +="'"+Field[i]+"'"; 改为 sql += Field[i];