Junilu Lacar wrote:Line 104 will result in an invalid SQL statement. If the table is "sometable" the it produces the string "TRUNCATE TABLEsometable". Same kind of problem with the next line.
Dave Tolls wrote:How are you running this?
I ask, because you should be seeing errors somewhere from that SQLException block.
Dave Tolls wrote:OK, so previous to correcting the SQL syntax you presumably got a SQLException being thrown and printed to the IDE console?
Ah!
I misread the catch block.
That should say:
This way you'll get all the important information about what has gone wrong and exactly where.
Junilu Lacar wrote:It's possible that getRowCount() and/or getColumnCount() of changedTableModel is returning 0. Did you double check that?
Junilu Lacar wrote:Your check for columns won't print anything if getColumnCount is zero because you'll never enter the loop. Put the println statement outside the loop. If you still don't get output, then that section of code is not getting executed at all.
And print out the value of changedTableModel.getColumnCount(), not column.
Junilu Lacar wrote:Ah, see this is why I don't like yuge methods, they hide disconnects between the intent and what's actually being done; they mislead you almost every time.
Line 5 in your last reply. What you're doing there is adding a listener. That's it. That's like saying "Ok, stand there and wait for something to happen, then do all this stuff."
Your code is still there standing there. Nothing has happened to actually make it execute. That is, nothing has happened that would trigger the table model to call the tableChanged() method of your listener.
Junilu Lacar wrote:You're not following standard naming conventions and this makes your code more difficult to read. Only constructors and class/interface names should be capitalized. Method and variable names should be camelcase starting with a lowercase letter.
Consider Paul's rocket mass heater. |