SurajThakur 0 Newbie Poster

I Cannot Login..Even with the correct ID and Pwd Its not going in the if(rsdoLogin.next()) loop...it comes in this page and just shows blank..PLz help..!!

CheckLogin.jsp

<%@ page language="java" import="java.sql.*" errorPage="" %>
<%

    Connection conn = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn = DriverManager.getConnection("jdbc:odbc:MyDsn");
    
    ResultSet rsdoLogin = null;
    PreparedStatement psdoLogin=null;
    
    String sUserID=request.getParameter("user");
    String sPassword=request.getParameter("pwd");
    String message="User login successfully ";
    
    try{
    String sqlOption="SELECT * FROM LoggedIn where UserID=? and Password=?";
    
    psdoLogin=conn.prepareStatement(sqlOption);
    psdoLogin.setString(1,sUserID);
    psdoLogin.setString(2,sPassword);
    
    rsdoLogin=psdoLogin.executeQuery();
    
    if(rsdoLogin.next())
    {
      String sUserName=rsdoLogin.getString("userID")+" "+rsdoLogin.getString("password");
     /*
      session.setAttribute("sUserID",rsdoLogin.getString("sUserID"));
      session.setAttribute("iUserType",rsdoLogin.getString("iUserType"));
      session.setAttribute("iUserLevel",rsdoLogin.getString("iUserLevel"));
      session.setAttribute("sUserName",sUserName);
     
      response.sendRedirect("success.jsp?error="+message);
	 */
	}
    else
    {
     message="No user or password matched" ;
     response.sendRedirect("IncorrLogin.jsp?error="+message);
    }
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
%>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.