executeUpdate() Insert,update,del和其他dml语句
executeQuery() select查询 

解决方案 »

  1.   

    executeUpdate() Insert,update,del和其他dml语句
    executeQuery() select查询 
    上面的都回答完了,哎来晚了~·
      

  2.   

    我的Statement对象只能执行Select语句,为什么不能执行Insert,update,del语句?
      public boolean updateArea( Area area){    Statement stmt=null;
        String sql=null;
        boolean result=false;     sql = "UPDATE area SET areaname='"+area.getAreaName()+"',"+
                                "description='"+area.getDescription()+"' "+
                                " WHERE id="+area.getId();
         System.out.println(sql);    try{      if (con.isClosed())
            throw new IllegalStateException("error unexpected");      stmt=con.createStatement();
          stmt.executeUpdate(sql);    }catch(Exception e){
    要象你们说的那么简单,我还提什么问?
      

  3.   

    把 e.printStackTrace()贴出来看看?
      

  4.   

    把生成的sql放到数据库中运行看是否出错,
    改写:
    int i = stmt.executeUpdate(sql);
    看到是不是真的没有符合筛选条件的纪录。跟踪一下,看看在运行stmt.executeUpdate(sql)时有没有抛出异常。
      

  5.   

    生成的sql放到数据库中运行正常捕捉不到异常我怀疑是sqlserver 2000权限问题,但检查权限好象都有啊
      

  6.   

    用sa登录?
    (随便一说,不太熟java连sql server)
      

  7.   

    如果生成的语句粘到查询分析器里能正常运行,用程序只能做Select而不能做更新,我想只能是权限的问题了。
      

  8.   

    System.out.println(stmt.execute(sql))返回false