各位大神帮忙,我用JDBC连接sqlserver提示连接成功了,但是当我写一个查询的方法时报以下错误是为什么?
com.microsoft.sqlserver.jdbc.SQLServerException:ThemethodexecuteQuery()cannottakeargu...
com.microsoft.sqlserver.jdbc.SQLServerException: The method executeQuery() cannot take arguments on a PreparedStatement or CallableStatement.
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:1578)
at com.ccg.exchangerate.dao.ExchangeRateDao.findExchangeRateList(ExchangeRateDao.java:32)
at com.ccg.exchangerate.debug.DeBug.main(DeBug.java:18)
实现类 conn=super.openconn();
String sql="select * from exchangerate";
stmt=conn.prepareStatement(sql);
rs = stmt.executeQuery(sql);
while(rs.next()){
Rate.getCurrencyFrom();
Rate.getCurrencyTo();
Rate.getEnddate();
Rate.getStartDate();
Rate.getRate();
Rate.getLastUpdateDateTime();
list.add(Rate);
} 展开
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:1578)
at com.ccg.exchangerate.dao.ExchangeRateDao.findExchangeRateList(ExchangeRateDao.java:32)
at com.ccg.exchangerate.debug.DeBug.main(DeBug.java:18)
实现类 conn=super.openconn();
String sql="select * from exchangerate";
stmt=conn.prepareStatement(sql);
rs = stmt.executeQuery(sql);
while(rs.next()){
Rate.getCurrencyFrom();
Rate.getCurrencyTo();
Rate.getEnddate();
Rate.getStartDate();
Rate.getRate();
Rate.getLastUpdateDateTime();
list.add(Rate);
} 展开
2013-09-06
展开全部
stms.executeQuery();
stms是preparedStatement,不需要传入参数。
stms是preparedStatement,不需要传入参数。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询