jsp頁(yè)面根據ID傳值修改(編輯)的問(wèn)題!
jsp頁(yè)面根據ID傳值修改是在后臺調用update接口:
在jdbc操作接口中寫(xiě)入如下代碼:
conn.setAutoCommit(false);//不用自己提交要執行完成后提交
String sql="insert into [article] values(?,?,?,?,getdate(),0)";
PreparedStatement pstm = conn.prepareStatement(sql);
pstm.setInt(1,id);
pstm.setInt(2,rootid);
pstm.setString(3,title);
pstm.setString(4,cont);
pstm.executeUpdate();
Statement st = conn.createStatement();
String sql1 = "update [article] set isleaf=1 where id="+id;//這里的id是jsp頁(yè)面傳過(guò)來(lái)的
st.executeUpdate(sql1);
執行完以上sql后,數據就根據id被更新了。