java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]在关键字 'User' 附近有语法错
StringUid=request.getParameter("Uid");StringUpassword=request.getParameter("Upassword...
String Uid=request.getParameter("Uid");
String Upassword=request.getParameter("Upassword");
String Uname="xxx";
try{
//建立连接
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:renshiguanli","","");
Statement stmt=con.createStatement();
//发送SQL语句,进行查询
ResultSet rs=stmt.executeQuery("select * from User ");
//输出查询结果
while(rs.next())
{
if(!(Uid.equals(rs.getString("Uid"))&&Upassword.equals(rs.getString("Upassword")))){
continue;
}
else {
Uname=rs.getString("Uname");
session.setAttribute("Uid1",String.valueOf(Uid));
session.setAttribute("Uname1",String.valueOf(Uname));
%>
<jsp:forward page="indexAdmit.jsp"/>
<%
}
}
%>
<jsp:forward page="reland.html"/>
<%
//关闭连接
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
out.println("出错了1!<p>"+e);
}
%> 展开
String Upassword=request.getParameter("Upassword");
String Uname="xxx";
try{
//建立连接
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:renshiguanli","","");
Statement stmt=con.createStatement();
//发送SQL语句,进行查询
ResultSet rs=stmt.executeQuery("select * from User ");
//输出查询结果
while(rs.next())
{
if(!(Uid.equals(rs.getString("Uid"))&&Upassword.equals(rs.getString("Upassword")))){
continue;
}
else {
Uname=rs.getString("Uname");
session.setAttribute("Uid1",String.valueOf(Uid));
session.setAttribute("Uname1",String.valueOf(Uname));
%>
<jsp:forward page="indexAdmit.jsp"/>
<%
}
}
%>
<jsp:forward page="reland.html"/>
<%
//关闭连接
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
out.println("出错了1!<p>"+e);
}
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询