Results 1 to 3 of 3
  1. #1
    nico is offline Member
    Join Date
    Aug 2011
    Posts
    1
    Rep Power
    0

    Post java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index

    <%
    int roleid=0;
    String username="",password="";
    String redir="";
    username=request.getParameter("username");
    password=request.getParameter("password");
    if(username==null||password==null||username.equals ("")||password.equals(""))
    {
    out.println("Username and Password is required.");%>
    <a href="login.jsp">Back</a>
    <%}
    else
    {
    try
    {
    rs=stmt.executeQuery("select UserName,Password,RoleName,RoleId,UserId,IsApprove d from admin where UserName='"+username+"' and Password='"+password+"'");
    while(rs.next())
    {
    if(rs.getByte(6)==1)
    {
    count=rs.getInt(4);
    roleid=Integer.parseInt(rs.getString(4));
    session.setAttribute("roleid",String.valueOf(rolei d));
    session.setAttribute("UserId",String.valueOf(rs.ge tInt(5)));
    if(rs.getString(3).equals("admin"))
    {
    redir="Admin/admin.jsp";
    }
    else{
    redir="User/user.jsp";
    }
    }
    else
    {
    out.println("Your account is block.");%>
    <a href="login.jsp">Back</a>
    <%return;
    }
    }
    if(count>0)
    {
    session.setAttribute("username",username);
    session.setAttribute("password",password);
    response.sendRedirect(redir);
    }
    else
    {
    out.println("Username and Password does not match.");
    }
    }
    catch(Exception e)
    {
    out.print(e);
    }
    }
    %>

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    1. Don't double post. Your other thread has been removed.

    2. Use code tags.

    db

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default

    And tell us the exact error complete with stack trace, and show us where it was thrown from (ie what line).

    Ino ther words, make it easy for us to spot where the problem might lie without guessing.

Similar Threads

  1. java.sql.SQLException: Invalid column name
    By agangaia in forum JDBC
    Replies: 7
    Last Post: 04-14-2011, 01:06 PM
  2. Replies: 1
    Last Post: 04-05-2010, 01:32 AM
  3. Replies: 1
    Last Post: 10-16-2008, 02:09 PM
  4. Replies: 1
    Last Post: 08-06-2007, 09:24 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •