连接数据库的代码:
Class.forName(driverName);
conn = DriverManager.getConnection (strUrl,username,password);
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
Class.forName(driverName);
conn = DriverManager.getConnection (strUrl,username,password);
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
涉及到字段关联等诸多问题,最好使用SQL语句!
public Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws SQLException
Creates a Statement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the createStatement method above, but it allows the default result set type and result set concurrency type to be overridden.
Parameters:
resultSetType - a result set type; see ******ResultSet.TYPE_XXX*******
resultSetConcurrency - a concurrency type; see ******ResultSet.CONCUR_XXX******
Returns:
a new Statement object
Throws:
SQLException - if a database access error occurs
Since:
1.2
See Also:
What Is in the JDBC 2.0 API
************************************************************************
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE1");
// rs will be scrollable, will not show changes made by others,
// and will be updatable
我的代码和你的一样啊,你的可以?TO:bobosji(波波司机)
java.sql.SQLException: 对只读结果集的无效操作: deleteRow
好像是有问题!
改完就不能用了!
什么意思:“改完就不能用了”?
怎么解决的?
ResultSet.TYPE_SCROLL_INSENSITIVE,
的缘故么?