Request User
Request User
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import connect.Connecting;
try {
String findAdminSQL = "SELECT USERNAME, PASSWORD FROM KHACHHANG";
statement = connection.createStatement();
while(resultSet.next()) {
if(resultSet.getString("USERNAME").equals(userName) &&
resultSet.getString("PASSWORD").equals(password)) {
isAdmin = true;
}
}
} catch (Exception e) {
e.getMessage();
}
Connecting.closeConnection(connection);
Connecting.closeStament(statement);
return isAdmin;
}
try {
preparedStatement = connection.prepareStatement(sqlString);
preparedStatement.setString(1, offline);
} catch (Exception e) {
e.getMessage();
}
Connecting.closeConnection(connection);
Connecting.closeStament(preparedStatement);
return danhSach;
}
try {
preparedStatement = connection.prepareStatement(setComputer);
preparedStatement.setString(1, tinhTrang);
preparedStatement.setString(2, userName);
preparedStatement.setString(3, computerName);
preparedStatement.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
Connecting.closeConnection(connection);
Connecting.closeStament(preparedStatement);
}
try {
preparedStatement = connection.prepareStatement(setComputer);
preparedStatement.setString(1, tinhTrang);
preparedStatement.setString(2, newUserName);
preparedStatement.setString(3, computerName);
preparedStatement.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
Connecting.closeConnection(connection);
Connecting.closeStament(preparedStatement);
}
try {
preparedStatement = connection.prepareStatement(getThoiGian);
preparedStatement.setString(1, userName);
thoiGian = resultSet.getInt("TIENNAP");
} catch (Exception e) {
// TODO: handle exception
}
Connecting.closeConnection(connection);
Connecting.closeStament(preparedStatement);
return thoiGian;
}
try {
sotTienCuaMay = resultSet.getInt("TIEN");
} catch (Exception e) {
// TODO: handle exception
}
Connecting.closeConnection(connection);
Connecting.closeStament(preparedStatement);
return sotTienCuaMay;
}
try {
preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, newPass);
preparedStatement.setString(2, userName);
if (preparedStatement.execute() == true) {
thanhcong = true;
}
} catch (Exception e) {
// TODO: handle exception
}
Connecting.closeConnection(connection);
Connecting.closeStament(preparedStatement);
return thanhcong;
}