1、占位符的作用是代替参数输入,防止SQL注入,即sql被恶意篡改
2、定义conn为数据库连接引擎就不写了String sq盟敢势袂l = "select * from table where id = ?";
3、result = conn.prepareStatement(sql);
4、pstmt.setString(1,id) ;绑定参数
1、占位符的作用是代替参数输入,防止SQL注入,即sql被恶意篡改
2、定义conn为数据库连接引擎就不写了String sq盟敢势袂l = "select * from table where id = ?";
3、result = conn.prepareStatement(sql);
4、pstmt.setString(1,id) ;绑定参数