java.sql.SQLException: [Microsoft][ODBC Microsoft Access 驱动程序] 参数不足,期待是 1。
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110)
sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
org.apache.jsp.delUser_jsp._jspService(delUser_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.
源代码:
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="GBK"%>
<%
//准备工作: 连接数据库
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("JDBC:ODBC:OA");
Statement stmt = conn.createStatement();
String u_id = request.getParameter("u_id");
String sql = "delete from userInfo where u_id = " + u_id;
int re = stmt.executeUpdate(sql);
if(re != -1){
%>
<script>
alert("员工信息已删除");
location = "showUser.jsp";
</script>
<%
}
%>
库名,表名,列名都没错的
数据库
------解决方案--------------------
int re = stmt.executeUpdate(sql);//这返回的是int吗?肯定是个ResultSet啊