Reputation: 2159
I am developing a java program, backend : MS Access . I have written the code there no error or Exception, all other buttons are working fine .
Only the button "insert" (used for inserting into database from GUI) is not working .. no error is shown by net beans .
b1.addActionListener(new ActionListener(){
@Override
public void actionPerformed (ActionEvent e)
{
String fname=t1.getText();
String lname=t2.getText();
String age=t3.getText();
try{
rs.moveToInsertRow();//moves cursor to new row
rs.updateString("Fname", fname);
rs.updateString("Lname", lname);
rs.updateString("age", age);
rs.insertRow();
//close two variable
st.close();
rs.close();
catch(Exception ex){
}
}
});
Upvotes: 0
Views: 91
Reputation: 2237
Follow these steps:
Add ex.printStackTrace(); in your catch block.
//close two variable
st.close();
rs.close();
catch(Exception ex){
ex.printStackTrace();
}
Run you application and try to insert a record
You may able to find the problem from the error message. If not paste the error message to the community for further help.
Upvotes: 1