Hi All
I m using NetBEans 3.6
IDE. I have one jTable in which when ever i load data from database it shows that 2 rows are in recordset but jTable shows only 1 row.
Kindly help me where i am wrong
ANAND
//////////////////////
private void loadGridDetailData1() {
try {
clearTable();
String sql = "Select acc_code,b_i_no, amount,narration,update from cash_rec_detail where voucher_no = 'CPV001' order by acc_code";
Statement st = cnnd.myDetailCon.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE );
ResultSet rsGridDtlAcct1 = st.executeQuery(sql);
int jj = 0;
int irR = 0;
if (rsGridDtlAcct1.next() == false) {
System.out.println("Data not found");
}
else {
addingRows(rsGridDtlAcct1.getFetchSize());
while(rsGridDtlAcct1.next())
{ System.out.println("Rows = " + irR);
tbl_PettyReceipt.setValueAt(rsGridDtlAcct1.getString(1), irR, jj); jj++;
tbl_PettyReceipt.setValueAt(str, irR, jj); jj++;
tbl_PettyReceipt.setValueAt(rsGridDtlAcct1.getString(2), irR, jj); jj++;
tbl_PettyReceipt.setValueAt(rsGridDtlAcct1.getString(3), irR, jj); jj++;
tbl_PettyReceipt.setValueAt(rsGridDtlAcct1.getString(4), irR, jj); jj++;
tbl_PettyReceipt.setValueAt(rsGridDtlAcct1.getString(5), irR, jj);
++irR;
jj=0;
}
}
}
catch (Exception e) {
}
}
<b> addingRows(rsGridDtlAcct1.getFetchSize()); </b>
The above code add rows in JTable depending on Rows in Database Table.