OCAJP 7
My problem is that my records keep overwriting themselves in the database.
What your code is doing is resetting the string stmt each line to be equal to the name, phone, etc.
I'd suggest you read the javadoc for StringBuilder, as this is one way of creating a single string object from multiple different lines.
The quieter you are, the more you are able to hear.
Stuie Clarky wrote:
I'd suggest you read the javadoc for StringBuilder, as this is one way of creating a single string object from multiple different lines.
Rakesh Keerthi wrote:Hi Gabor,
i think you forgot to call while(resultset.next()){}
Thanks
The quieter you are, the more you are able to hear.
Gabor Beke wrote:BTW AUTO_INCREMENT is always needed for tables to make new row?
Dropping and recreating the table right after connection means that you'll lose all data from previous runs of your application. Might be good for testing, but definitely not for production code, unless you're creating some kind of temporary tables this way.
Don't get me started about those stupid light bulbs. |