SQL >select count(*) from Teacher where teacherCode=? and te
来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/29 01:38:48
SQL >select count(*) from Teacher where teacherCode=? and teacherPassword=? java.sql.SQLException:
SQL >select count(*) from Teacher where teacherCode=? and teacherPassword=?
java.sql.SQLException: Can not issue executeUpdate() for SELECTs
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
public int execOther(final String strSQL, final Object[] params){
this.fetchFreeConnection();
try {
this.pstmt = this.conn.prepareStatement(strSQL);
System.out.println(new Date()+"\nSQL >"+strSQL);
for (int i = 0; i < params.length; i++) {
this.pstmt.setObject(i+1, params[i]);
}
int count = this.pstmt.executeUpdate();
return count;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return -1;
}
}
SQL >select count(*) from Teacher where teacherCode=? and teacherPassword=?
java.sql.SQLException: Can not issue executeUpdate() for SELECTs
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
public int execOther(final String strSQL, final Object[] params){
this.fetchFreeConnection();
try {
this.pstmt = this.conn.prepareStatement(strSQL);
System.out.println(new Date()+"\nSQL >"+strSQL);
for (int i = 0; i < params.length; i++) {
this.pstmt.setObject(i+1, params[i]);
}
int count = this.pstmt.executeUpdate();
return count;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return -1;
}
}
int count = this.pstmt.executeUpdate();
改为
int count = this.pstmt.executequery();
你执行的是select语句,调用的确实update方法.查询语句要是用查询的方法.
再问: TeacherDaoImpl.java中 DBCPConnection.java中loginaction中报错
改为
int count = this.pstmt.executequery();
你执行的是select语句,调用的确实update方法.查询语句要是用查询的方法.
再问: TeacherDaoImpl.java中 DBCPConnection.java中loginaction中报错
SQL >select count(*) from Teacher where teacherCode=? and te
SQL语句理解 select * from B where (select count(1) as num from A
$sql="SELECT count(*) as pcount FROM news" 和$sql = "UPDATE a
SELECT COUNT(*) FROM Users WHERE Id={0} AND LoginPwd = '{1}'
select A,B,C,D=(select count(*) from 表 where c=a.a and b=a.b
String sql = "select * from tb_consumer where account='" + a
sql="select discount_value from shop_discount where discount
select count(*) as total from ddcm_news where key=a
SQL 语句 "SELECT * FROM {{table}} WHERE `fleet_end_time`
ms sql :select * from (select *from b) as xxx where 和 select
sql查询的where条件为什么要加1,完整格式变成select * from * where 1 and * and*
select * from teacher where s_id in(select s_id from student