Note that there are some explanatory texts on larger screens.

plurals
  1. POkeep id in name field from mysql database
    primarykey
    data
    text
    <p>I have a login UI. when login is perform user id and login id insert into logging table. UI have username field, password field and branch field.when name , password ,branch is fill and press login button user id and logdate insert into logging table. how i can solve this.</p> <p>insert table in logging table...........</p> <pre><code>public User insertuserloginDate(Connection con,int userid,Timestamp logtime){ String sql="INSERT into logging values(?,?,?)"; String sql1="Select * from user"; try { Statement stm=con.createStatement(); // ResultSet rs=stm.executeQuery(sql1); // while (rs.next()){ User u=new User(rs.getInt(1)); // return u; } PreparedStatement ps=con.prepareStatement(sql); ps.setInt(1, userid); ps.setTimestamp(2, logtime); ps.setInt(3, getRecord()); ps.executeUpdate(); ps.close(); con.close(); } catch (SQLException ex) { System.out.println("Error while login record " + ex); } return null; </code></pre> <p>and in button action............</p> <pre><code>private void buttonloginActionPerformed(java.awt.event.ActionEvent evt) { char[] temp_pwd = userpassword.getPassword(); String pwd = null; pwd = String.copyValueOf(temp_pwd); System.out.println("password " + pwd); //try { // TODO add your handling code here: if (user.loginApplication(connect.getCon(), username.getText(), pwd, userbranch.getSelectedItem().toString())) { System.out.println("success "); MainForm mainForm = new MainForm(); mainForm.setVisible(true); user.insertuserloginDate(connect.getCon(), user.getUid(), user.getLogdate()); System.out.println("record user log time " +user.getUid()); // user.getuser(connect.getCon()); }else { JOptionPane.showMessageDialog(null, "Login Failed!", "Failed!", JOptionPane.ERROR_MESSAGE); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload