Editing Contacts Doesnt Seem to Work :(
this is my editContact method:publicvoid editContact(ContactPanel updatePanel){
try{
preparedStatement = connection.prepareStatement("update CONTACTS set NAME = ?, NUMBER = ?, EMAIL = ? where ID = ?");
preparedStatement.setString(1, updatePanel.getName());
preparedStatement.setString(2, updatePanel.getNumber());
preparedStatement.setString(3, updatePanel.getEMail());
preparedStatement.setInt(4, updatePanel.getID());
preparedStatement.executeUpdate();
}catch(SQLException ex){
ex.printStackTrace();
}
}
for some reason it doesnt work. i use it like this in another class of my program:if(event.getSource() == doneButton){
contactNameField.setText(editNameField.getText());
contactNumberField.setText(editNumberField.getText());
contactEMailField.setText(editEMailField.getText());
contactIO.editContact(this);
editDialog.dispose();
}
any1know what the problem could be? thnx guys :)
[1442 byte] By [
Alex1989a] at [2007-11-27 9:17:13]

> this is my editContact method: public void
> editContact(ContactPanel updatePanel){
> try{
> preparedStatement =
> connection.prepareStatement("update CONTACTS set
> NAME = ?, NUMBER = ?, EMAIL = ? where ID = ?");
> preparedStatement.setString(1,
> updatePanel.getName());
> preparedStatement.setString(2,
> updatePanel.getNumber());
> preparedStatement.setString(3,
> updatePanel.getEMail());
> preparedStatement.setInt(4,
> updatePanel.getID());
>preparedStatement.executeUpdate();
> tch(SQLException ex){
> ex.printStackTrace();
> }
for some reason it doesnt work. i use it
> like this in another class of my program:
> if(event.getSource() == doneButton){
>
> ontactNameField.setText(editNameField.getText());
>
> ontactNumberField.setText(editNumberField.getText());
>
> ontactEMailField.setText(editEMailField.getText());
> contactIO.editContact(this);
> editDialog.dispose();
> }
any1know what the problem could be?
> thnx guys :)
Sorry but I'm unfamiliar with the words any1know and thnx - could you please clarify them ?
> Define "doesn't work" -- is it throwing an exception?
> Is nothing in the CONTACT table changing?
nope, no exceptions r thrown. yea nothing in the contact table is changing :(
> And what value does executeUpdate return?
it returns 1, so that means that a row was updated?
Message was edited by:
Alex1989