开发者

Resultset Shows first 12 Rows empty of jTable - Java

I have created a Method in a same class, which take SQL Query as a parameter but there is a problem:

First time when I call

ABC(String sqlQuery)//Method Definition

this Method is working fine for me.And when I implement action performed event on a button with the following code. then there is problem.

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 

jScrollPane1.getViewport().remove(jTabl开发者_Go百科e1);
ABC(sqlQuery_f2);// Call Mothod and pass parameter
jTable1=new JTable(data,column);
jScrollPane1.getViewport().add(jTable1);

}

When the first time ABC Method is called , the result shows 12 records in jTable and When I call again with the above code on actionperformed, it start record from 13th row to onward and first 12 Row are empty.

When I second time call the Method by Passing Query as a Parameter, It should be start from the first Row and also no row should be there at start even empty rows.

Note: I am using NetBeans and the follwing code is in non-Editable area :

jTable1.setModel(new DefaultTableModel(data, column));

And I have also declare two arrays named data and Column

Resolution ?


According to your scenerio, I think when you first call this method(), you probably use a counter to fill the table according to the row count. Next time the counter already has value = 12, then it increments starting from 13.

I think you need to set counter = 0 at the end of this method.

The name counter is assumed to be an int variable, but may be you have some other name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜