救命!!!!!!!!!!!!!

zjasan 2003-07-22 05:52:11
奇怪的错误,下面的语句出现这种奇怪的异常!!!
String sql="select id from jicq where name=? and password=?";
PreparedStatement prepare3=c.prepareCall(sql);
prepare3.clearParameters();
//name="'"+name+"'";
//passwd="'"+passwd+"'";
prepare3.setString(1,name);
prepare3.setString(2,passwd);
System.out.println("#############"+sql);
try{
ResultSet r1=prepare3.executeQuery(sql);
System.out.println("测试语句");
while(r1.next()){
no=r1.getInt(1);
}
}
catch(Exception e2){
e2.printStackTrace();


}
System.out.println("no="+no);
out.println(no);
c.close();

异常输出:
#############select id from jicq where name=? and password=?
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid call S
tatement method: {0}
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown So
urce)
at ServerThread.run(Server.java:149)
no=0
...全文
19 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjasan 2003-07-22
  • 打赏
  • 举报
回复
什么意思??
sasa_sasa 2003-07-22
  • 打赏
  • 举报
回复
这个:prepare3.setString(1,name);
prepare3.setString(2,passwd);
就在PreparedStatement prepare3=c.prepareCall(sql);之前
期末救命资源!~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧