可以使用PreparedStatement对象执行SQL语句“delete from score where stuID=?”,并将需要删除的学生ID作为参数传递给PreparedStatement对象的setString()方法。示例代码如下:

String sql = "delete from score where stuID=?";
try {
    PreparedStatement pstmt = conn.prepareStatement(sql);
    pstmt.setString(1, "1001"); // 设置需要删除的学生ID为1001
    pstmt.executeUpdate();
} catch (SQLException e) {
    e.printStackTrace();
}
可以使用对象执行SQL语句delete from score where stuID=

原文地址: https://www.cveoy.top/t/topic/1zv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录