检索student中所有记录的语句如下 String sql="select * from student"; 执行命令,返回执行结果的语句为()
A: ResultSet rs=stmt.executeQuery(sql);
B: ResultSet rs=stmt.execute(sql);
C: ResultSet rs=stmt.executeUpdate(sql);
A: ResultSet rs=stmt.executeQuery(sql);
B: ResultSet rs=stmt.execute(sql);
C: ResultSet rs=stmt.executeUpdate(sql);
举一反三
- 假定已经获得一个数据库连接,使用变量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__;
- 下面选项中,主要用于执行DML和DDL语句的是(<br/>) A: ResultSet<br/>rs = stmt.executeDDL(sql); B: ResultSet<br/>rs = stmt.executeUpdate(sql); C: ResultSet<br/>rs = stmt.executeDelete(sql); D: ResultSet<br/>rs = stmt.executeDML(sql);
- 语句ResultSet rs=stmt.executeUpdate(sql);正确(设变量都已经定义)。
- 用于stmt执行查询语句,执行后返回代表结果集的ResultSet对象rs的实现代码是___。(注:代码后加英文分号)
- 要执行str="select * from customer"语句,假设Statement对象stmt,执行SQL语句的代码哪个正确? A: stmt.executeQuery(str) B: stmt.executeUpdate(str) C: stmt.executeSelect(str) D: stmt.executeDelete(str)