I am trying to update my derby database but it seems that the update isn't working. Mainly the database doesn't update. I have tried various ways but each seems to not update the fields. Below is my code. I have also tried using the "?" with each column entry (example: PROJNAME = ?) along with PreparedStatements setting the PreparedStatement to a JTextField -but that didn't work either. Using the insert statement works fine --just the UPDATE statement doesn't. The System print (System.out.println) does print all the entries correctly. Any help is appreciated. This is my first time using the UPDATE statement --so I am unsure what I'm doing wrong. I'm using Netbeans 8.2 and Derby.
System Print output:
100 2nd Ave
TBD at CONTRACTING
If a user enters in an SQL pattern for the WHERE/LIKE clause then that same pattern will be used to update the field (when you get this working), I don't think you want to be adding '%' to live DB fields.
Paul is correct. Use "?" for all variable values, including the selector logic.
One reason to be careful of upper/lower case in database column names is that different databases handle things differently. Often to get the desired results you have to use some sort of quoting mechanism.
Far safer to just stick to lower-case column naming.
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"
Thanks all. Just how to I include the selector logic in a search parameter? The variable is designated in the program earlier --hence the use of "doSEARCH" to contain the search parameter previously identified. I use the CRM case numbers as serach parameters. The search CRM number (contained in doSEARCH) is compared to the table record's CRM number.