Salve ,

sto cercando di aggiungere a un mio programma finito e perfettamente funzionante una nuova funzione che credo sia la più importante cioè la modifica dei dati nel DB ACCESS attraverso la maschera grafica...solo che ho trovato parecchie difficoltà chiedo gentilmente una mano se possibile vi posterò gran parte del codice ...Ringraziamenti anticipati...

Allora:
-----------------------------------------------------------------------------------
import java.awt.*;
import java.awt.Color;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JLabel;
import javax.swing.UIManager;
import java.util.*;
import java.sql.*;

class Sigea extends JFrame implements MouseListener{

private static final String ls = System.getProperty("line.separator");

Dichiarazione dei pulsanti

JButton b=new JButton("Inserisci");
JButton b1=new JButton("Cerca");
JButton b2=new JButton("Elimina");
JButton b3=new JButton("Tutti");
JButton b4=new JButton("Modifica");

ECC....
----------------------------------------------------------------------------------

public boolean cliccato=true;
public boolean FALSO=false;

public Vector v;
public static int i;
public String s,C,m,ce,n,n_1,n_2,n_3,n_4,n_5,n_6,n_7,n_8,n_9,n_1 0,n_11,n_12,n_13,n_14,n_15,n_16,n_17,n_18,n_19;
public TextArea outputTextArea = new TextArea(" ",20, 230);
public final static String icona="C://Documents and Settings/Gaetano/Documenti/NetBeansProjects/Sigea/dist/Icona.gif";

ECC...
-------------------------------------------------------------------------------------

ButtonHandler bh = new ButtonHandler();


b.addActionListener(bh);
b1.addActionListener(bh);
b2.addActionListener(bh);
b3.addActionListener(bh);
b4.addActionListener(bh);

p1.add(b);
p1.add(b1);
p1.add(b2);
p1.add(b4);
ECC...
-------------------------------------------------------------------------------------

/*Interrogo il DataBase*/
public void Interroga(){
v=new Vector();
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbcdbc:Sigea");
Statement stat = con.createStatement();
ResultSet res = stat.executeQuery("SELECT * FROM Sigea");
int pos=1;
while (res.next()) {

C=res.getString("Numero");
n=res.getString("Titolo");
m=res.getString("Q_s");
ce=res.getString("Cognome");
n_1=res.getString("Nome");
n_2=res.getString("M_f");
n_3=res.getString("Iscrizione");
n_4=res.getString("Solvenza");
n_5=res.getString("Indirizzo");
n_6=res.getString("CAP");
n_7=res.getString("Citta");
n_8=res.getString("Provincia");
n_9=res.getString("Tel_ufficio");
n_10=res.getString("Tel_abitazione");
n_11=res.getString("Ente");
n_12=res.getString("Indirizzo_ente");
n_13=res.getString("E_mail");
n_14=res.getString("Laurea_diploma");
n_15=res.getString("Specializzazione");
n_16=res.getString("Professione");
n_17=res.getString("Cf__Iva");
n_18=res.getString("Data_iscrizione");
n_19=res.getString("Regione");

s=" "+C+" \n "+n+" \n "+m+" "+ce+" \n "+n_1+" \n "+n_2+" \n "+n_3+" \n "+n_4+" \n "+n_5+" \n "+n_6+" \n "+n_7+" \n "+n_8+" \n "+n_9+" \n "+n_10+" \n "+n_11+" \n "+n_12+" \n "+n_13+" \n "+n_14+" \n "+n_15+" \n "+n_16+" \n "+n_17+" \n "+n_18+" \n "+n_19+" ";
v.addElement(s);
pos++;
i++;



}

res.close();
stat.close();
con.close();
} catch (Exception e) {
outputTextArea.append("Problema: " + e.toString());
outputTextArea.append(System.getProperty("line.sep arator"));
}

}
//Popolo la TextArea
public void tutti(){

int cont=1;


Enumeration e=v.elements();
outputTextArea.setText("");
while(e.hasMoreElements()){



outputTextArea.append(cont+"\n"+e.nextElement().to String());
outputTextArea.append(System.getProperty("line.sep arator"));
outputTextArea.append(System.getProperty("line.sep arator"));


cont++;
}
}

/*Ricerca i soggetti specificati*/
public void cerca(String nome, String cognome){
outputTextArea.setText("\n\n\t\tPer cercare un Iscritto digitare COGNOME" +
" e NOME Nell'apposita Aria di testo...\n\n");
t4.setText("Digitare qui il nome da cercare...");
t3.setText("Digitare qui il cognome da cercare...");
b3.setEnabled(cliccato);




try{
Connection con = DriverManager.getConnection("jdbcdbc:Sigea");
Statement stat = con.createStatement();
ResultSet res = stat.executeQuery("SELECT * FROM Sigea where Cognome="+"'"+cognome+"'"+"AND Nome="+"'"+nome+"'"+"");

while(res.next()){

t.setText(res.getString("Numero"));
t1.setText(res.getString("Titolo"));
t2.setText(res.getString("Q_s"));
t3.setText(res.getString("Cognome"));
t4.setText(res.getString("Nome"));
t5.setText(res.getString("M_f"));
t6.setText(res.getString("Iscrizione"));
t7.setText(res.getString("Solvenza"));
t8.setText(res.getString("Indirizzo"));
t9.setText(res.getString("CAP"));
t10.setText(res.getString("Citta"));
t11.setText(res.getString("Provincia"));
t12.setText(res.getString("Tel_ufficio"));
t13.setText(res.getString("Tel_abitazione"));
t14.setText(res.getString("Ente"));
t15.setText(res.getString("Indirizzo_ente"));
t16.setText(res.getString("e_mail"));
t17.setText(res.getString("Laurea_diploma"));
t18.setText(res.getString("Specializzazione"));
t19.setText(res.getString("Professione"));
t20.setText(res.getString("Cf__Iva"));
t21.setText(res.getString("Data_iscrizione"));
t22.setText(res.getString("Regione"));
outputTextArea.append(res.getString("Numero")+" \n TITOLO: "+res.getString("Titolo")+" \n Q-S: "+res.getString("Q_s")+" COGNOME: "+res.getString("Cognome")+" \n NOME: "+res.getString("Nome")+" \n M/F: "+res.getString("M_f")+" \n ISCRIZIONE: "+res.getString("Iscrizione")+" \n SOLVENZA: "+res.getString("Solvenza")+" \n INDIRIZZO: "+res.getString("Indirizzo")+" \n CAP: "+res.getString("CAP")+" \n Citta: "+res.getString("Citta")+" \n PROVINCIA: "+res.getString("Provincia")+" \n TEL-UFFICIO: "+res.getString("Tel_ufficio")+" \n TEL-ABITAZIONE: "+res.getString("Tel_abitazione")+" \n ENTE: "+res.getString("Ente")+" \n INDIRIZZO-ENTE: "+res.getString("Indirizzo_ente")+" \n E-MAIL: "+res.getString("E_mail")+" \n LAUREA-DIPLOMA: "+res.getString("Laurea_diploma")+" \n SPECIALIZZAZIONE: "+res.getString("Specializzazione")+" \n PROFESSIONE: "+res.getString("Professione")+" \n CF/P.IVA: "+res.getString("Cf__Iva")+" \n DATA-ISCRIZIONE: "+res.getString("Data_iscrizione")+" \n REGIONE: "+res.getString("Regione")+""+ls+ls);
}



res.close();
stat.close();
con.close();
return;
} catch (Exception e) {
outputTextArea.setText("");
// JOptionPane.showMessageDialog(null, "Problema "+e, "alert", JOptionPane.ERROR_MESSAGE);

}


return;
}

/*Inserisce i soggetti nel DataBase*/
public void inserisci(String numero,String titolo,String q_s,String cognome,String nome,String m_f,String iscrizione,String solvenza,String indirizzo,String CAP,String citta,String provincia,String tel_ufficio,String tel_abitazione,String ente,String indirizzo_ente,String e_mail,String laurea_diploma,String specializzazione,String professione,String cf_iva,String data_iscrizione,String regione){

b3.setEnabled(cliccato);
if(!numero.equalsIgnoreCase("") && !titolo.equalsIgnoreCase("")
&& !q_s.equalsIgnoreCase("") && !cognome.equalsIgnoreCase("")
&& !nome.equalsIgnoreCase("") && !m_f.equalsIgnoreCase("")
&& !iscrizione.equalsIgnoreCase("") && !solvenza.equalsIgnoreCase("")
&& !indirizzo.equalsIgnoreCase("") && !CAP.equalsIgnoreCase("")
&& !citta.equalsIgnoreCase("") && !provincia.equalsIgnoreCase("")
&& !tel_ufficio.equalsIgnoreCase("") && !tel_abitazione.equalsIgnoreCase("")
&& !ente.equalsIgnoreCase("") && !indirizzo_ente.equalsIgnoreCase("")
&& !e_mail.equalsIgnoreCase("") && !laurea_diploma.equalsIgnoreCase("")
&& !specializzazione.equalsIgnoreCase("") && !professione.equalsIgnoreCase("")
&& !cf_iva.equalsIgnoreCase("") && !data_iscrizione.equalsIgnoreCase("")
&& !regione.equalsIgnoreCase("")) {
try{
Connection con = DriverManager.getConnection("jdbcdbc:Sigea");
Statement stmt = con.createStatement();
con.setAutoCommit(true);
stmt.addBatch("INSERT INTO Sigea(Numero,Titolo,Q_s,Cognome,Nome,M_f,Iscrizion e,Solvenza,Indirizzo,CAP,Citta,Provincia,Tel_uffic io,Tel_abitazione,Ente,Indirizzo_ente,E_mail,Laure a_diploma,Specializzazione,Professione,Cf__Iva,Dat a_iscrizione,Regione) VALUES ("+"'"+numero+"',"+"'"+titolo+"',"+"'"+q_s+"',"+"' "+cognome+"',"+"'"+nome+"',"+"'"+m_f+"',"+"'"+iscr izione+"',"+"'"+solvenza+"',"+"'"+indirizzo+"',"+" '"+CAP+"',"+"'"+citta+"',"+"'"+provincia+"',"+"'"+ tel_ufficio+"',"+"'"+tel_abitazione+"',"+"'"+ente+ "',"+"'"+indirizzo_ente+"',"+"'"+e_mail+"',"+"'"+l aurea_diploma+"',"+"'"+specializzazione+"',"+"'"+p rofessione+"',"+"'"+cf_iva+"',"+"'"+data_iscrizion e+"',"+"'"+regione+"'"+")");
int [] updateCounts = stmt.executeBatch();

outputTextArea.setText("Inserito:\n\n Numero: "+numero+" \n Titolo: "+titolo+" \n Q/S: "+q_s+" \n Cognome: "+cognome+" \n Nome: "+nome+" \n M/F: "+m_f+" \n Iscrizione: "+iscrizione+" \n Solvenza: "+solvenza+" \n Indirizzo: "+indirizzo+" \n Cap: "+CAP+" \n Citta: "+citta+" \n Provincia: "+provincia+" \n Tel/Ufficio "+tel_ufficio+" \n Tel/Abitazione: "+tel_abitazione+" \n Ente: "+ente+" \n Indirizzo/Ente: "+indirizzo_ente+" \n E_mail: "+e_mail+" \n Laurea/Diploma: "+laurea_diploma+" \n Specializzazione: "+specializzazione+" \n Professione: "+professione+" \n CF/P.IVA: "+cf_iva+" \n Data-Iscrizione: "+data_iscrizione+" \n Regione: "+regione);
outputTextArea.append(ls);
con.close();
stmt.close();
return;

}catch(Exception b){
JOptionPane.showMessageDialog(null, "Problema"+b, "alert", JOptionPane.ERROR_MESSAGE);
}
}else{
Object[] options = { "OK" };
JOptionPane.showOptionDialog(null, "Inserire dati i campi sono vuoti", "Warning",
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,null, options, options[0]);
}
if(nome.equalsIgnoreCase("credits")){
outputTextArea.setText("Product: Sigea"+ls+"Version:1.0"+ls+ls+
"Author: XXXXXX"+ls+
"Ringraziamenti: XXXXXX. "+ls+ls+
"~ XXXXXXXX ~"+ls);
}

}




}

/*Modifica i soggetti specificati*/
public void modifica(String * , String * , String * ECC....){

Qui come potrei fare per implementare la funzione di modifica che riempendo i campi di testo e premendo il pulsante modifica mi dovrebbe modificare i dati nel db???
}

4){[/B]