当前位置: 代码迷 >> Java Web开发 >> 请教一下PreparedStatement的问题,在线等~~~
  详细解决方案

请教一下PreparedStatement的问题,在线等~~~

热度:98   发布时间:2008-08-15 10:19:47.0
请教一下PreparedStatement的问题,在线等~~~
请教一下PreparedStatement的问题,在线等~~~

我写了一个更新数据库的方法
public static void updatepiaoshu()
{
      Connection con=null;
      PreparedStatement pstmt=null;

      try
      {
          con=ConectionFactory.getConnection();  //写了一个连接工厂
          pstmt=con.prepareStatement("update candidates set quantity=quantity+1 where candidateId=?");
          pstmt.setInt(1,1);   
          pstmt.executeUpdate();
      }catch(SQLException se)
       {System.out.println(se.getMessage());}
     finally
    {
          ConnectionFactory.closePrepareStatement(pstmt);
          ConnectionFactory.closeConnection(con);   
    }
}

总是显示无效的列索引~~~ ,请高手指点!!!!!!!!!
搜索更多相关主题的帖子: 数据库  pstmt  con  quantity  null  

----------------解决方案--------------------------------------------------------
回复 1# goopoolzl 的帖子
sb,肯定是你的字段名写错了!
----------------解决方案--------------------------------------------------------
我觉得也可能是上面的原因
----------------解决方案--------------------------------------------------------
  相关解决方案