ASP,Net3333
ASP,Net3333
/**
*
* @author khalifa salem
*/
import java.sql.*;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class login extends javax.swing.JFrame {
Statement stmt;
ResultSet rs;
Connection con;
/**
* Creates new form login
*/
public login() {
initComponents();
dbcon();
}
public final void dbcon()
{
try{Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
}
catch
(ClassNotFoundException ex)
{
JOptionPane.showMessageDialog(login.this,ex.getMessage());
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("��� ��������");
jLabel2.setText("���� ������");
jButton1.setText("����� ������");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("����");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
pack();
}// </editor-fold>
try{
if(jTextField1.getText().equals("")||jTextField2.getText().equals(""))
{
JOptionPane.showMessageDialog(login.this,"������ �����
������","�����",JOptionPane.INFORMATION_MESSAGE);
return;
}
con = DriverManager.getConnection("jdbc:ucanaccess://E:/stu.mdb");
stmt=con.createStatement();
if(rs.next()){
JOptionPane.showMessageDialog(null,"����� ���");
this.hide();
}
else
{
this.dispose();
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the
default look and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
}
//</editor-fold>