连接数据库的代码:
Class.forName(driverName);
conn = DriverManager.getConnection (strUrl,username,password);
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

解决方案 »

  1.   

    最好不要直接操作数据库!
    涉及到字段关联等诸多问题,最好使用SQL语句!
      

  2.   

    createStatement
    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
    ************************************************************************
      

  3.   

    ?贴段JDK文档来干嘛?以为我没有啊?
      

  4.   

           Statement stmt = con.createStatement(
                                          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
      

  5.   

    TO:netkid()
    我的代码和你的一样啊,你的可以?TO:bobosji(波波司机)
    java.sql.SQLException: 对只读结果集的无效操作: deleteRow
      

  6.   

    to ender(ender) :
    好像是有问题!
    改完就不能用了!
      

  7.   

    TO:rinehart(rinehart)
    什么意思:“改完就不能用了”?
      

  8.   

    糟了,我自己解决了,分给谁呢?CSDN真无聊,不能给自己分,自己解决了还得把分给别人,真是……
      

  9.   

    to ender(ender)
    怎么解决的?
      

  10.   

    从netkid()哪里得到一些启发……分就给他吧……rinehart(rinehart)和bobosji(波波司机)积极参与,也来点参与奖……哈,其实很简单的,不过我还没想通是什么原因……你们猜到没?还没猜到的话就开个贴送分给我,我就告诉你们……
      

  11.   


    ResultSet.TYPE_SCROLL_INSENSITIVE,
    的缘故么?