Hi All,
I am trying with my below JSP code to validate the username and password which enter from my page by verifying with the username and password in Microsoft Access database.
I never get any error alert with that code, but i also get blank on my page instead.
The code are below:
<html>
<head>
<title>Welcome to the online Auction...</title></head>
<body>
<%@ page language ="java" import = "java.io.*" import = "java.lang.*" import = "java.sql.*" %>
<% try
{
String strUsername = request.getParameter("username");
String strPassword = request.getParameter("password");
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
Connection myConn = DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=C:/Auction/Auction.mdb");
Statement myStatement = myConn.createStatement ();
String strSQL = "SELECT [UserName], [Password] FROM tblUserDetails";
ResultSet myResult = myStatement.executeQuery(strSQL);
String strUser = myResult.getString("UserName");
String strPass = myResult.getString("Password");
while(myResult.next())
{
if(strUsername.equals(strUser) && strPassword.equals(strPass))
{
out.println("Login Successful!");
}
else
{
out.println("Login Fail!");
}
}
myConn.close();
}
catch(Exception e){}
%>
</body>
</html>
Could you please advise what is the problems?
Kimsan