Wednesday, April 11, 2012

Login to use the database

Now we will discuss how to use the database login first ... I think soib soib .. already know java is what I do not need to explain how to make a database and look for connections that do not know wrote on this blog entry if I forget or lose .. you wrote a comment .... I'll put it like lightning as soon as possible .... if we continue the struggle ... for the beginner who is just learning java would be the first ..... we design look like the picture below .. well, though not good it looks okay i guess for soib soib we now use the normal login aja .. if you want to use combo box the addition I will discuss if I want to ... if anyone would like dah heheh yes let's begin making do login to use the database

I think soib soib can do the design as shown above nga nga anything nice like that's what the importance of a first click 2 times the log has been entered into the search text coding login
public class login extends javax.swing.JFrame {  usually located at the top sob
See if dah. make on it a case of this

import java.sql.*;
import javax.swing.*;
import javax.swing.table.*;

okay sob could psti
Hereinafter looking for this kind of coding

public login() {
        initComponents();
        koneksi();
    }
See if dah. make a case under this




public void koneksi (){
    try {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        conn=DriverManager.getConnection("jdbc:odbc:film","root","");
        cn=conn.createStatement();
    }catch(Exception e){
        JOptionPane.showMessageDialog(null,"koneksi belum tersambung ke database" );
        System.out.println(e.getMessage());


    }
}

public void cariuser (){
    try {


        String sql = "select * from login where username=" +
                "'" + jTextField1.getText() + "' and password=" +
                "'" + jPasswordField1.getText() + "'";
        ResultSet rs = cn.executeQuery(sql);
        if (rs.next())
        {
            JOptionPane.showMessageDialog(null,"data yang anda masukan betul...!!!!");
           new Menu_utama().show();
            this .dispose();
        }
    }catch (Exception e){
        JOptionPane.showMessageDialog(null, "maap ada kesalahan di username/password yang anda masukan coba ulangin lagi...");


    }}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        cariuser();
}


    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.dispose();
}



Well its shelf tired wrote it .. heheh speaking sob willing Indonesia explanation module dowload wrote yes .. I have to make an explanation of each command can do dah ... sob more more details ..... okay
Take wrote here for free .. do not use pay-




No comments:

Post a Comment

SOP Door Lock Activity Reading

Door Lock Activity Reading 1        1.    Prepare DTU Unit. 2.    Switch “On” DTU Unit. 3.    Put in Staff Code DTU, press Enter. ...