From a quick browse of your code I've spotted an issue that I think is likely to be causing your problem. Your JButton
Ajouter
from your IHM_2
instance created in main()
is doing the following in it's ActionListener
;
DAO_2 dr=new DAO_2();
dr.operation();
running dr.operation();
then creates a
Metier_2 er = new Metier_2();
which then uses the text values from the NEW IHM_2
window to get the values to parse to the SQL query. The trouble is that er
holds a reference to a completely new instance of a IHM_2
JFrame
, and the fields will be empty. So each time you are running the query you are passing it empty strings. Hence why the values in your textFields from your original JFrame
are never making it to the table.
For this to work, your Metier_2
object needs to hold a reference to the IHM_2
object created in your main() method, not a brand new one. Or better yet, just pass your IHM_2
instance directly to your new DAO_2
through it's constructor, and then you wouldn't even need the Metier_2
class at all.
I hope this helps. Let me know how you get on.