• 2022-06-11
    假定数据库已经正确建立连接conn,下述代码实现删除一条记录的功能,将代码补充完整。[br][/br] String sql = "delete from users_info where id=?"; 【1】 ps = conn.prepareStatement(sql);[br][/br] ps.setInt(1, id); ps.【2】 ;
  • PreparedStatement#executeUpdate()

    举一反三

    内容

    • 0

      已知,存在 QueryRunner对象 runner ,SQL语句: String sql = "delete from user where id=?"; 下面操作中,能实现删除记录id=1的操作是() A: int num =runner.delete(sql, 1); B: int num =runner.update(sql, 1); C: Object num =runner.delete(1, sql); D: Object num =runner.update(1, sql);

    • 1

      已知,存在 QueryRunner对象 runner ,SQL语句:String sql = "delete from user where id=?";下面操作中,能实现删除记录id=1的操作是( ) A: Object num =runner.update(1, sql); B: Object num =runner.delete(1, sql); C: int num =runner.delete(sql, 1); D: int num =runner.update(sql, 1);

    • 2

      删除student表中id为1的记录,下列语句正确的是 A: DELETE student WHERE id=1; B: DELETE FROM student WHERE id=1; C: DELETE FROM student WHERE id:=1; D: DELETE student WHERE id:=1;

    • 3

      删除student表中id为1的记录() A: TRUNCATE FROM student where id=1; B: DELETE student where id=1; C: DELETE FROM student where id=1; D: DELETE INTO student where id=1;

    • 4

      假定已经获得一个数据库连接,使用变量conn来表示。下列语句中能够正确获得结果集的有__1__。(选择两项)[br][/br] A.Statement stmt = conn.createStatement()__2__;[br][/br] ResultSet rs = stmt.executeQuery(“SELECT * FROM STUDENT”);[br][/br] B.Statement stmt = conn.createStatement(“SELECT * FROM STUDENT”);[br][/br] ResultSet rs = stmt.executeQuery()__3__;[br][/br] C.PreparedStatement stmt = conn.prepareStatement()__4__;[br][/br] ResultSet rs = stmt.executeQuery(“SELECT * FROM STUDENT”);[br][/br] D.PreparedStatement stmt = conn.prepareStatement(“SELECT * FROM STUDENT”);[br][/br] ResultSet rs = stmt.executeQuery()__5__;