object吧 关注:236贴子:353
  • 0回复贴,共1

java 中从Jtable到数据库,总是报错,帮忙看一下 谢谢了

只看楼主收藏回复

for (int i = 0; i < rowNum; i++) {
String stringjtable1 = SalesOrder.jTable.getValueAt(i, 0).toString().trim();
String stringjtable2 = SalesOrder.jTable.getValueAt(i, 1).toString().trim();
String stringjtable3 = SalesOrder.jTable.getValueAt(i, 2).toString().trim();
String stringjtable4 = SalesOrder.jTable.getValueAt(i, 3).toString().trim();
String stringjtable5 = SalesOrder.jTable.getValueAt(i, 4).toString().trim();
int stringjtable6 = Integer.parseInt(SalesOrder.jTable.getValueAt(i, 5).toString().trim());
int stringjtable7 = Integer.parseInt(SalesOrder.jTable.getValueAt(i, 6).toString().trim());
int stringjtable8 = Integer.parseInt(SalesOrder.jTable.getValueAt(i, 7).toString().trim());
String stringjtable9 = SalesOrder.jTable.getValueAt(i, 8).toString().trim();
String stringjtable10 = SalesOrder.jTable.getValueAt(i, 9).toString().trim();
System.out.println(stringjtable3);
String addData1 = "insert into " + string +" values("
+ stringjtable1 + ","
+ stringjtable2 + ","
+ stringjtable3 + ","
+ stringjtable4 + ","
+ stringjtable5 + ","
+ stringjtable6 + ","
+ stringjtable7 + ","
+ stringjtable8 + ","
+ stringjtable9 + ","
+ stringjtable10 + ")"; //报错说这一句有问题,也试过直接插入固定的文本数字 ,是好使的,
System.out.println(addData1);
sqlServer.doSqlSentence(addData1);


1楼2017-06-01 09:04回复