technohead
Technical User
Hi,
i am logging in using username and password. I want to validate this so that what is in the database is equal to what was entered into the login fields. below is the select statement i used to get the info from the database. how do i use a .equals to compare whats in the database to what was typed in.
Thanks
class GSTSLoginHelper
{
GSTSDBConnection conn = new GSTSDBConnection();
conn.getConnection();
public void validate(String CustomerName, String CustomerPwd)
{
String sql = ("Select ut_userType from userTable where ut_userName = '"+CustomerName+"' and ut_password = '"+CustomerPwd+"'"
Statement stat = con.createStatement();
ResultSet rs = stat.executeQuery(sql);
while(rs.next)
{
ut_userType = rs.getString("ut_userType"
System.out.println(rs.getString("ut_userType"
}
}
}
i am logging in using username and password. I want to validate this so that what is in the database is equal to what was entered into the login fields. below is the select statement i used to get the info from the database. how do i use a .equals to compare whats in the database to what was typed in.
Thanks
class GSTSLoginHelper
{
GSTSDBConnection conn = new GSTSDBConnection();
conn.getConnection();
public void validate(String CustomerName, String CustomerPwd)
{
String sql = ("Select ut_userType from userTable where ut_userName = '"+CustomerName+"' and ut_password = '"+CustomerPwd+"'"
Statement stat = con.createStatement();
ResultSet rs = stat.executeQuery(sql);
while(rs.next)
{
ut_userType = rs.getString("ut_userType"
System.out.println(rs.getString("ut_userType"
}
}
}