Well, I'm not sure exactly what you are trying to do, but this code:
Looks suspicious because it results in your WHERE clause being "WHERE Lastname = ''". I don't think that's your intent? Maybe it should be like:
If that's not the answer, then you may need to post more of a description of what you're trying to do. Also, whenever you're having trouble with a particular SQL statement string, always print it out (e.g. System.out.println) right before you execute it. Then you can at least verify that the values set in the string are correct. [ February 02, 2003: Message edited by: Blake Minghelli ]
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
"Rosewell", Your name does not comply with the JavaaRanch naming standard. http://www.javaranch.com/name.jsp. We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements. Thanks. Dave
I think it's more likely to be the common JDBC-ODBC insert/update problem. You could help us out by only posting the relevant code rather than everything... To test it out, try doing a dummy read after an update. That is, do a select on the same connection that returns a single row. You don't have to read this data. It appears that queries get cached by the driver and so you have to do 'one more' to get the previous one commited. Also, it doesn't appear that you close the database connection. This is a bad practice and may be contributing to the error you are seeing. It is a practice that will certainly cause you other problems in the future. I hope this solves your problem. Dave
Joined: Feb 04, 2003
What version of Access are you using? What version of Windows? I have been struggling with problems updating existing records as well. New records were fine, just existing ones were not being updated even though the jdbc calls returned like they were updated. I'm stuck using Access, so I couldn't get around it! I tried the dummy query to no avail. Due to major time crunch on my project I resorted to the RmiJdbc server "adapter" to bypass this problem so I could continue development at least. Finally today I fixed the update problem. From what I have found, there is a bug in the odbc driver that comes with windows 2000 Service Pack 2. I don't know if this applies to any other setup but I upgraded to Service Pack 3 and while I still have to force the update with a dummy query, it does work. You can download the latest MDAC package (free on microsoft at the URL below) to get the driver from there although I don't know if this will cause other problems (highly likely considering it's Microsoft). http://www.microsoft.com/data/download.htm