Hi, This is almost a JDBC problem but think it is more to do with my GUI as I have tested my database connection and everything is working fine. Anyway I am trying to insert data from my form into the database but don't know how to fetch the data from the form into the query. Can anyone help? the class with the form is
and the actual insert page is
I am guessing the problem is that I haven't really specified where the fields are but all the examples I can find create their forms in a panel and then use that but since I have created mine straight into a frame I am a little lost on how to do this. Thanks
So what you are really asking is how to add your TextFields (AWT) or JTextFields (Swing) to a Frame or JFrame? aFrame.add(aField) OR jFrame.getContentPane().add(jField) There's a little more to it, since the default layout manager for a Frame or JFrame is java.awt.BorderLayout. Just adding fields to it will put all your fields on top of each other in the center. Try a GridLayout with two rows and alternate adding a Label (or JLabel) and a field. For more information, consult the Java Tutorial: Creating a GUI with Swing. The "Laying Out Components Within a Container" chapter will be particularly helpful.
Does your code compile ok? Are there any exceptions thrown when you run this code?
The nice thing about Standards is that there are so many to choose from!
Joined: Apr 02, 2003
It compiles and runs but when I click the button to insert the data I get a load of exception messages. I have tested the database connection and that is working fine the problem seems to be than the insert query doesn't know which form fields I am trying to insert from.