This week's book giveaway is in the Flex forum. We're giving away four copies of Flex 4 in Action and have Tariq Ahmed, Dan Orlando, John C. Bland II & Joel Hooks on-line! See this thread for details.
Hello everyon!
Please help me on this
I want to save data to my database from my JTable here is the code for the save method
called here
SaveBtn = new JButton("Save Row");
SaveBtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
try{
Visit vInfo = new Visit();
VisitMethods savmthd = new VisitMethods();
savmthd.save(vInfo);
model.fireTableRowsUpdated(0, visittable.getSelectedRow()+1);
}catch(Exception ex){
ex.printStackTrace();
}
}
});
When I try to save a user entry it gives this exception
java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6986)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3149)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:216)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:138)
at VisitMethods.save(VisitMethods.java:114)
refer to : ps.executeUpdate();
at VisitTable$1.actionPerformed(VisitTable.java:50)
refer to: savmthd.save(vInfo);
I now know that those blank lines come from the empty assignments I did. So i'm thinking of a parameterised constructor with 5 paramters that I'm going to assign to the instance fields like this
But my concern is the values are entered in the JTable row not in textfields, if it were textfields I could call the Parameterised constructor with 5 variables for which the values would be the values of the textfields.
So please help on how do this with JTable!
Thanks.