import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
//预处理方式
public class preperSTest {
public static void main(String[] args) throws SQLException
{
delete();
}
private static void delete() throws SQLException {
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
// 创建连接
conn = JdbcUtils.getConnection();
String sql = " delete from student where id = 1";
ps = conn.prepareStatement(sql);
int i = ps.executeUpdate();
System.out.println(i);
} finally {
JdbcUtils.release(rs, ps, conn);
}
}
}
删前:
删后:
原文链接:https://blog.csdn.net/w605283073/article/details/46572501
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。
还没有人抢沙发呢~