java rcp出现Can not issue data manipulation statements with executeQuery(). 5
代码如下:publicvoidsetTable(){tableItem=newTableItem(table,SWT.NONE);JdbcTooljt=newJdbcTo...
代码如下:
public void setTable(){
tableItem = new TableItem(table, SWT.NONE);
JdbcTool jt = new JdbcTool();
String sql1 = "DELETE FROM crashcart";
jt.query(sql1);
String sql = "SELECT id,g_name,g_price FROM shelf WHERE id ='"+ txtGoodsId.getText() +"'";
List<List<String>> list = jt.query(sql);
String sql2 = "INSERT INTO crashcart (id,g_name,g_price,c_number) VALUES('"+ list.get(0).get(0) +"','"+ list.get(0).get(1) +"','"+ list.get(0).get(2) +"',1)";
jt.query(sql2);
String sql3 = "SELECT id,g_name,g_price,c_number FROM crashcart";
List<List<String>> list2 = jt.query(sql3);
for(List<String> row : list2){
TableItem tableItem = new TableItem(table, SWT.NONE);
tableItem.setText(0,row.get(0));
tableItem.setText(1,row.get(1));
tableItem.setText(2,row.get(2));
tableItem.setText(3,row.get(3));
}
} 展开
public void setTable(){
tableItem = new TableItem(table, SWT.NONE);
JdbcTool jt = new JdbcTool();
String sql1 = "DELETE FROM crashcart";
jt.query(sql1);
String sql = "SELECT id,g_name,g_price FROM shelf WHERE id ='"+ txtGoodsId.getText() +"'";
List<List<String>> list = jt.query(sql);
String sql2 = "INSERT INTO crashcart (id,g_name,g_price,c_number) VALUES('"+ list.get(0).get(0) +"','"+ list.get(0).get(1) +"','"+ list.get(0).get(2) +"',1)";
jt.query(sql2);
String sql3 = "SELECT id,g_name,g_price,c_number FROM crashcart";
List<List<String>> list2 = jt.query(sql3);
for(List<String> row : list2){
TableItem tableItem = new TableItem(table, SWT.NONE);
tableItem.setText(0,row.get(0));
tableItem.setText(1,row.get(1));
tableItem.setText(2,row.get(2));
tableItem.setText(3,row.get(3));
}
} 展开
1个回答
2015-04-20 · 知道合伙人互联网行家
关注
展开全部
你好,很高兴为你解答
解决方案如下:
http://zhidao.baidu.com/link?url=uRHnQygaG4oh14gWhyzW55tI5uvrZ7fxoCZEiCP1FxvyIqXxxofNkvJoiy2OK9LyyeocmyQhw3TbzpykEMUk5VoV7lwSp4pB4UU7rjH30Bi
如有其他问题,可以继续追问,您的采纳是我前进的动力!
解决方案如下:
http://zhidao.baidu.com/link?url=uRHnQygaG4oh14gWhyzW55tI5uvrZ7fxoCZEiCP1FxvyIqXxxofNkvJoiy2OK9LyyeocmyQhw3TbzpykEMUk5VoV7lwSp4pB4UU7rjH30Bi
如有其他问题,可以继续追问,您的采纳是我前进的动力!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询