| Author |
whts wrong in this statement?
|
Keshini Weerasuriya
Greenhorn
Joined: Jan 08, 2006
Posts: 24
|
|
Hi.. I'm trying to save changes and update the record. But this doesn't seem to work. Can anyone help? st.executeUpdate("UPDATE Client " + "SET (CliId = '"+id+"', Surname = '"+surname+"', FirstName = '"+firstname+"', Title = '"+Gen+"',NICNo = '"+NIC+"' , Image = '"+image+"',Address = '"+Address+"', TelNo = '"+no+"',Email = '"+mail+"')");
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
Is there any exception ? Are you issuing a commit, after your update operation. Just a suggestion, use PreparedStatement. Shailesh
|
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
|
 |
Martin Simons
Ranch Hand
Joined: Mar 02, 2006
Posts: 196
|
|
Well, for one, you don't need parens around the set fields, also a couple of your field names have "No" in the name, which I assume means number. You are adding these fields as if they are strings, so check that those fields are actually character and not number types in the database, and last, but definately not least, there is no where clause in this update statement. Do you really wish to update every row in the table with this information or did you want to only update a specific row?
|
 |
Keshini Weerasuriya
Greenhorn
Joined: Jan 08, 2006
Posts: 24
|
|
|
No exceptions.. But the new data doesn't get updated
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
put the complete method Shailesh
|
 |
Keshini Weerasuriya
Greenhorn
Joined: Jan 08, 2006
Posts: 24
|
|
I changed the statement to String query = "UPDATE Client SET (CliId = '"+id+"', Surname = '"+surname+"', FirstName = '"+firstname+"', Title = '"+Gen+"',NICNo = '"+NIC+"' , Image = '"+image+"',Address = '"+Address+"', TelNo = '"+no+"',Email = '"+mail+"') WHERE CliId = '" +id+ "'"; st.executeUpdate(query); Now it says java.sql.SQLException: ORA-00907: missing right parenthesis
|
 |
Martin Simons
Ranch Hand
Joined: Mar 02, 2006
Posts: 196
|
|
|
I would say remove the parens around the set fields.
|
 |
Keshini Weerasuriya
Greenhorn
Joined: Jan 08, 2006
Posts: 24
|
|
|
Thanks Martin.. That worked.. :-)
|
 |
 |
|
|
subject: whts wrong in this statement?
|
|
|