jdbc-obdc resultset returning more than expected
Hi,
Need Help,
Here is the thing,I have a table on an acces DB with 3k rows, in order to use it efficiently every query is topped just like the one below.
select top 100 catclientes.codigo,catclientes.nombre,catclientes.rfc,catclientes.calle,catclientes.numero,catclientes.codcolonia,catclientes.comercial,catclientes.telefono,catclientes.direccion,catclientes.estado,catclientes.pais,catclientes.comentarios,catclientes.fax,catclientes.email,catclientes.curp,catclientes.contacto,catcolonia.cp,catcolonia.colonia,catcolonia.tipo,catcolonia.ciudad,catcolonia.zona from catclientes left join catcolonia on catclientes.codcolonia=catcolonia.codigo where catclientes.codigo LIKE '%' and catclientes.nombre LIKE '%' and catclientes.rfc LIKE '%' and catclientes.eliminado=false
after executing the query, I try to fit the resultset into a table, the process works like a charm while the table population is below 100, but once the table has more than that the resultset fetches more than that....
here is the process I use:
publicstatic javax.swing.JTable getTableFromRS(java.sql.ResultSet RS,int limitcolumns){
javax.swing.JTable Table=new javax.swing.JTable();
try{
java.sql.ResultSetMetaData RSMD = RS.getMetaData();
RS.last();
int jx=RS.getRow();
if(limitcolumns==0||limitcolumns>RSMD.getColumnCount()){
limitcolumns=RSMD.getColumnCount();
}
String[] Nombres =new String[limitcolumns];
for(int i=1;i<=limitcolumns;i++){
Nombres[i-1] = RSMD.getColumnName(i).toUpperCase();
}
String[][] Objeto =new String [jx][limitcolumns];
int j=0;
RS.beforeFirst();
while (RS.next()){
for(int i=1;i<=limitcolumns;i++){
Objeto[j][i-1]=RS.getString(i);
}
j++;
}
finalboolean[] canEdit =newboolean[limitcolumns];
for(int i=0;i<canEdit.length;i++){
canEdit[i]=false;
}
Table.setBorder(new javax.swing.border.TitledBorder(""));
Table.setModel(new javax.swing.table.DefaultTableModel(
Objeto,
Nombres
){
publicboolean isCellEditable(int rowIndex,int columnIndex){
return canEdit [columnIndex];
}
});
}catch(java.sql.SQLException e){
System.out.println(e+" ><etool.line226>");
e.printStackTrace();
}
return Table;
}
on the last debug run the jx temp variable got a > 3000 value when it was supposed to have 100.
Am I wrong or anyone knows a way to fix this without changing the query? (that is if the query itself is formulated without errors)

