下面代码如何连接ACCESS数据库 15
java.sql.SQLException:[Microsoft][ODBCMicrosoftAccessDriver]查询值的数目与目标字段中的数目不同。package...
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 查询值的数目与目标字段中的数目不同。
package myservlet.control;
import mybean.data.*;
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HandleExit extends HttpServlet
{ public void init(ServletConfig config) throws ServletException
{ super.init(config);
}
public String handleString(String s)
{ try{ byte bb[]=s.getBytes("iso-8859-1");
s=new String(bb);
}
catch(Exception ee){}
return s;
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{ HttpSession session=request.getSession(true);
Login login=(Login)session.getAttribute("login"); //获取用户登录时的Javabean
boolean ok=true;
if(login==null)
{ ok=false;
response.sendRedirect("login.jsp"); //重定向到登录页面
}
if(ok==true)
{ continueDoPost(request,response);
}
}
public void continueDoPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{ HttpSession session=request.getSession(true);
session.invalidate(); //销毁用户的session对象
response.sendRedirect("index.jsp"); //返回主页
}
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{ doPost(request,response);
}
} 展开
package myservlet.control;
import mybean.data.*;
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HandleExit extends HttpServlet
{ public void init(ServletConfig config) throws ServletException
{ super.init(config);
}
public String handleString(String s)
{ try{ byte bb[]=s.getBytes("iso-8859-1");
s=new String(bb);
}
catch(Exception ee){}
return s;
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{ HttpSession session=request.getSession(true);
Login login=(Login)session.getAttribute("login"); //获取用户登录时的Javabean
boolean ok=true;
if(login==null)
{ ok=false;
response.sendRedirect("login.jsp"); //重定向到登录页面
}
if(ok==true)
{ continueDoPost(request,response);
}
}
public void continueDoPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{ HttpSession session=request.getSession(true);
session.invalidate(); //销毁用户的session对象
response.sendRedirect("index.jsp"); //返回主页
}
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{ doPost(request,response);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询