java.sql cursor!!!
843836Mar 15 2004 — edited Mar 15 2004<P>
<%@ page import = "java.sql.*" %>
<%@ page import = "java.util.*" %>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:grocery","","");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT CustId, CustName, CustPw FROM Customer");
String inptId = request.getParameter("tid");
String inptPw = request.getParameter("tpw");
while (rs.next())
{
String dbId = rs.getString("CustId");
String dbName = rs.getString("CustName");
String dbPw = rs.getString("CustPw");
if(inptId.equalsIgnoreCase(dbId) && inptPw.equalsIgnoreCase(dbPw))
{
session.attribute("id", dbId);
session.attribute("name", dbName);
response.sendRedirect("welcome.jsp");
}
else
{
response.sendRedirect("loginpage.jsp");
}
}
%>
________________________________________________
i seem to have a problem with the cursor state. cannot target the row of data when it hits match for the if case... any suggestions?