错误是不兼容的类型,找到int需要java.sql.ResultSet rs=prst.executeUpdate() ;
publicvoidupdateNote(Notenote)throwsException{DataBaseConnectiondb=newDataBaseConnect...
public void updateNote(Note note)throws Exception{
DataBaseConnection db = new DataBaseConnection();
Connection conn = db.getConnection();
String sql = "update notes set ntitle = ?,ncontent=? where nid=?";
PreparedStatement prst = conn.prepareStatement(sql) ;
prst.setString(1,note.getNtitle());
prst.setString(2,note.getNcontent());
prst.setInt(3,note.getNid());
rs=prst.executeUpdate() ;
if(rs.next()){
flag=true;
}
db.close();
} 展开
DataBaseConnection db = new DataBaseConnection();
Connection conn = db.getConnection();
String sql = "update notes set ntitle = ?,ncontent=? where nid=?";
PreparedStatement prst = conn.prepareStatement(sql) ;
prst.setString(1,note.getNtitle());
prst.setString(2,note.getNcontent());
prst.setInt(3,note.getNid());
rs=prst.executeUpdate() ;
if(rs.next()){
flag=true;
}
db.close();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询