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]
# 1

> 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 ?

Aknibbsa at 2007-7-12 22:07:31 > top of Java-index,Java Essentials,Java Programming...
# 2
Define "doesn't work" -- is it throwing an exception? Is nothing in the CONTACT table changing?And what value does executeUpdate return?
BigDaddyLoveHandlesa at 2007-7-12 22:07:31 > top of Java-index,Java Essentials,Java Programming...
# 3
> Sorry but I'm unfamiliar with the words any1know and> thnx - could you please clarify them ?Don't lose all hope. In this thread: http://forum.java.sun.com/thread.jspa?threadID=5189789I got someone to promise to type out "y-o-u".
BigDaddyLoveHandlesa at 2007-7-12 22:07:31 > top of Java-index,Java Essentials,Java Programming...
# 4

> 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

Alex1989a at 2007-7-12 22:07:31 > top of Java-index,Java Essentials,Java Programming...