I'm pretty new to this so maybe be stupid question but here goes:
I have created a
servlet that via an sql statement get login and password value from mysql database. I then compare this to user and param parameters entered in html login page.
I then compare the userparam and userpassord against the database information and I get the following error:
Error! Opening connection has failed: java.sql.SQLException: Before start of result set
java.sql.SQLException: Before start of result set
I cannot see what is causing this error.
I'm really struggling here, here the code causing error:
String queryEmpUser = "SELECT * FROM employees WHERE ((login = '" + userParam +"')"
+" AND (password = '"+ passwordParam +"'))";
String queryClients = "SELECT * FROM clients";
//Store username information
stmtEmpUser = connection.createStatement();
stmtClients = connection.createStatement();
rsEmpUser = stmtEmpUser.executeQuery(queryEmpUser);
ResultSetMetaData rsmdEmp = rsEmpUser.getMetaData();
Vector Clients = new Vector();
System.out.println("Query = " +queryEmpUser + "<P>");
System.out.println("userParam = " +userParam + "<P>");
//This is where error is occuring - if ( rsEmpUser.getString("login").equals(userParam) &&
rsEmpUser.getString("password").equals(passwordParam) ) {
Can someone help please?
Cheers Joe