救命!!!!!!!!!!!!!
奇怪的错误,下面的语句出现这种奇怪的异常!!!
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