1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
| import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
public class VGHD extends JFrame {
private JPanel contentPane;
private JTextField tfEssai;
private JTextField tFUrl;
/**
* Launch the application.
*/
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
VGHD frame = new VGHD();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public VGHD()
{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
tfEssai = new JTextField();
tfEssai.setBounds(10, 69, 414, 20);
contentPane.add(tfEssai);
tfEssai.setColumns(10);
tFUrl = new JTextField();
tFUrl.setBounds(10, 11, 414, 20);
contentPane.add(tFUrl);
tFUrl.setColumns(10);
int opcion = JOptionPane.showConfirmDialog(null, "Nouvelle partie ?", "Aviso", JOptionPane.YES_NO_OPTION);
if (opcion == 0)
{
tfEssai.setText("Oky");
}
else
{
tfEssai.setText("Dommage");
}
// String dbUrl="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ= D:\\VirtualGirlHD.mdb";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
tfEssai.setText("titus : "+e1.getMessage());
}
String dbUrl="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=D:\\VirtualGirlHD.mdb";
String User="";
String password="";
ResultSet Infos;
tFUrl.setText(dbUrl);
String SQL="SELECT NomGirl, NumGirl FROM Girl WHERE Girl.NumGirl=75";
try
{
Connection cDB= DriverManager.getConnection(dbUrl);
Statement sDB= cDB.createStatement();
Infos=sDB.executeQuery(SQL);
Infos.next();
//tfEssai.setText(Infos.getString(0));
//Set BD=Server.CreateObject("ADODB.Connection");
//BD.Open "Microsoft.ACE.OLEDB.12.0;Data Source=D:\\VirtualGirlHD.mdb;";
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
tfEssai.setText(e.getMessage());
}
}
} |
Partager