Note that there are some explanatory texts on larger screens.

plurals
  1. POjtable takes "" into database when editing
    text
    copied!<p>here is my sample code</p> <pre><code>DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); int colum=jTable1.getSelectedColumn(); int row=jTable1.getSelectedRow(); System.out.println("row of selected is "+row+"col is "+colum); String remark1 = (String) jTable1.getValueAt(row, 8); String remark2 = (String) jTable1.getValueAt(row, 9); String stock = (String) jTable1.getValueAt(row, 10); String invoiceno =(String) jTable1.getValueAt(row, 11); String id=(String) jTable1.getValueAt(row, 12); System.out.println("remark1: "+remark1+" ,remark2: "+remark2+",stock:"+stock+", invoiceno:"+invoiceno+ " ,id: "+id); </code></pre> <p>when ever I open the <code>jTable1</code> in edit mode and come out without entering text into it and perform the action ill get output like this </p> <pre><code>remark1: ,remark2: ,stock: , invoiceno: ,id: 7e3c63ffc9bc42dba8155270741d7c9a </code></pre> <p>and when i send that row to database at that fields its taking <code>"</code> at those fields.. which is creating me problem. how do i stop by not sending <code>"</code> into database when I just go into edit mode and come out of it without editing text/adding text</p> <p>I tried adding this </p> <pre><code>line 426: if(invoiceno.equals("")){ invoiceno=null; } </code></pre> <p>if i go into editmode of <code>invoiceno</code> <code>jTable1</code> and come out, its passing argument <code>invoiceno=null</code> and working fine. But if I dont go into that row(editmode) then send into database then its showing null <code>java.lang.NullPointerException</code> at <code>line:426</code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload