要执行str="select * from customer"语句,假设Statement对象stmt,执行SQL语句的代码哪个正确?
A: stmt.executeQuery(str)
B: stmt.executeUpdate(str)
C: stmt.executeSelect(str)
D: stmt.executeDelete(str)
A: stmt.executeQuery(str)
B: stmt.executeUpdate(str)
C: stmt.executeSelect(str)
D: stmt.executeDelete(str)
举一反三
- 要在Statement对象stmt上执行SELECT语句“select*fromAddress”,可以使用________。 A: stmt.execute("select*fromAddress"); B: stmt.executeQuery("select*fromAddress"); C: stmt.executeUpdate("select*fromAddress"); D: stmt.query("select*fromAddress");
- stmt为Statement对象,执行String sqlStatement = "delete from book where bid='tp1001' ";语句后,删除数据库表的记录需要执行stmt.executeUpdate ( )语句
- stmt 为Statement对象,执行String sqlStatement=”delete from book where bid=’tp1001’”;语句后,删除数据库表的记录需要执行____语句
- 假定已经获得一个数据库连接,使用变量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__;
- 用于stmt执行查询语句,执行后返回代表结果集的ResultSet对象rs的实现代码是___。(注:代码后加英文分号)