 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Savf Guest
|
Posted: Thu Dec 30, 2004 8:46 am Post subject: Passaggio parametri connessione dbase |
|
|
Ho l'apertura del database nella seguente maniera:
private void ConnectDBF() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("jdbc:odbc:DataBase", "", "");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from Soci order by
Cognome");
while (rs.next()){
System.out.println(rs.getString("Codice")+ "*" +
rs.getString("Cognome") + "*" + rs.getString("Nome"));
}
}
catch (Exception e){
System.out.println("Impossibile connettersi");
}
}
Ovviamente questo e inserito
public class MenuTessere extends javax.swing.JFrame {
java.sql.Connection con;
JFrame frame;
public MenuTessere() {
initComponents();
ConnectDBF();
}
..........
Come posso fare a passare la connessione a un altra classe? e il relativo
recordset?
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|