Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void displayUpdate(){
- DateFormat daydf = new SimpleDateFormat("dd");
- DateFormat monthdf = new SimpleDateFormat("MM");
- DateFormat yeardf = new SimpleDateFormat("yyyy");
- try
- {
- Class.forName("com.mysql.jdbc.Driver");
- Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/employee", "root", "");
- Statement st = connect.createStatement();
- rs = st.executeQuery("SELECT empno, firstname,lastname,deptcode,phoneno,hiredate,job FROM employee where empno = " + currentid);
- rs.next();
- empnoTField1.setText(rs.getString(1));
- fnameTField1.setText(rs.getString(2));
- lnameTField1.setText(rs.getString(3));
- deptCodeCombo1.setSelectedItem(rs.getString(4));
- phoneTField1.setText(rs.getString(5));
- hiredate1.setText(rs.getString(6));
- /* Date date = rs.getDate(6);
- String day = daydf.format(date);
- String month = monthdf.format(date);
- String year = yeardf.format(date);
- dayTField.setText(day);
- monthTField.setText(month);
- yearTField.setText(year);
- */
- jobTField1.setText(rs.getString(7));
- connect.close();
- }
- catch(SQLException sqe){
- System.out.println("SQL error: " + sqe.toString());
- }
- catch(ClassNotFoundException cnf) {
- System.out.println("Class not found error : " + cnf.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement