更新时间:2023-12-03 11:53:04
关于第二个问题. 您可以先在表中检查变量,然后再将其放入查询中.例如,您可以执行以下操作:
As for your second question. You can check your variable in your table before you put it inside your query. For example you can do this:
String item1;
if(table.getValueAt(i, 0) != null)
item1 = table.getValueAt(i, 0);
else
item1 = null;
用"table.getValueAt(i,0)"替换item1并为"table.getValueAt(i,2)"创建一个item2
Replace item1 with you "table.getValueAt(i, 0)" and create an item2 for your "table.getValueAt(i,2)"
String sql1 = "INSERT INTO HREmpListofCard (EmpID, CardNbr, Status, Remarks) VALUES ("
+"'"+empID
+"','"+ITEM1
+"','"+val
+"','"+ITEM2+"')";
我还没有测试过,所以不确定它是否可以工作:)
I haven't tested this, so I'm not sure if it will work :)
祝你好运!