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);
}
}
%>