![]() |
#2
gankailan2008-08-15 12:05
回复 1# goopoolzl 的帖子
|
请教一下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);
}
}
总是显示无效的列索引~~~ ,请高手指点!!!!!!!!!