做毕业设计又遇到郁闷的问题了,高手帮忙
源码如下:
<%@ page contentType= "text/html;charset=GB2312 " %>
<%@ page import= "java.sql.* " %>
<HTML>
<BODY>
<% Connection con;
Statement sql;
ResultSet rs;
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
}
catch(
ClassNotFoundException e)
{
out.print( "该数据驱动方式不存在! ");
}
//try
//{
con=DriverManager.getConnection( "jdbc:odbc:bysj ", "sa ", "513278 ");
sql=con.createStatement();
String userID=request.getParameter( "userID ");
String password=request.getParameter( "userpassword ");
String sqlString =new String( "SELECT userID,password FROM user WHERE userID= ' "+userID+ " ' ");//错误所在行
rs=sql.executeQuery(sqlString);
if(!rs.next())
{
out.print( "该用户不存在!请 <a href= 'login.jsp '> 重新登陆 </a> ");
}
else{
if(!rs.getString(3).equals(password))
out.print( "您输入的密码不正确!请 <a href= 'login.jsp '> 重新登陆 </a> ");
else
{
if(rs.getInt(5)==1)
response.sendRedirect( "usermain.jsp ");
if(rs.getInt(5)==2)
response.sendRedirect( "managermain.jsp ");
if(rs.getInt(5)==1)
response.sendRedirect( "leader.jsp ");
}
}