Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- String username=jTextField1.getText();
- String password=jPasswordField1.getText();
- Connection Driver;
- if(username.length()>0)
- {
- if(password.length()>0)
- {
- try {
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- Connection con=DriverManager.getConnection("jdbc:odbc:CRS");
- Statement st=con.createStatement();
- ResultSet rs=st.executeQuery("select * from login where username='"+jTextField1.getText()+"' and Password='"+jPasswordField1.getText()+"'");
- if(rs.next())
- {
- //String s=rs.getString();
- home obj=new home();
- obj.setVisible(true);
- }
- else{
- jLabel4.setVisible(true);
- }
- }
- catch (Exception ex) {
- Logger.getLogger(login.class.getName()).log(Level.SEVERE, null, ex);
- }
- }else
- {
- JOptionPane.showMessageDialog(this,"please enter the password");
- }
- }else
- {
- JOptionPane.showMessageDialog(this,"please enter the username");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement