java中向mysql数据库添加数据 添加不进去?
Stringa,b,c,d,e,f,g;sqlCommand="INSERTINTOSTUDENTS(number12,name12,sex12,age12,tel12,...
String a,b,c,d,e,f,g;
sqlCommand = "INSERT INTO STUDENTS(number12,name12,sex12,age12,tel12,major12,class12)"
+ "VALUES("+a+","+b+","+c+","+d+","+e+","+f+","+g+")";
当a。。g 是数字的时候 就能存进数据库 但如果是汉字或字母就不行了
若:sqlCommand = "INSERT INTO STUDENTS(number12,name12,sex12,age12,tel12,major12,class12)"
+ "VALUES(‘草’,‘草’,‘草’,‘草’,‘草’,‘草’,‘草’)"; 这样就行 why??????????
a,,,g的值是通过jtextfield的gettet()得到的
ps:数据库驱动方面没有问题
求指教
jtextfield的gettext 展开
sqlCommand = "INSERT INTO STUDENTS(number12,name12,sex12,age12,tel12,major12,class12)"
+ "VALUES("+a+","+b+","+c+","+d+","+e+","+f+","+g+")";
当a。。g 是数字的时候 就能存进数据库 但如果是汉字或字母就不行了
若:sqlCommand = "INSERT INTO STUDENTS(number12,name12,sex12,age12,tel12,major12,class12)"
+ "VALUES(‘草’,‘草’,‘草’,‘草’,‘草’,‘草’,‘草’)"; 这样就行 why??????????
a,,,g的值是通过jtextfield的gettet()得到的
ps:数据库驱动方面没有问题
求指教
jtextfield的gettext 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |