here is the code that has error:
public synchronized String[][] getAllProjectB(String office)
{
Vector rows = new Vector();
command = String.valueOf("select * from project"
try
{
con = dc.getConnect();
stmt = con.createStatement();
results.setFetchSize(8000);
for(results = stmt.executeQuery(command); results.next();
rows.addElement(new Integer(results.getInt(16))))
{
rows.addElement(results.getString(2));
rows.addElement(results.getString(3));
rows.addElement(results.getString(4));
rows.addElement(results.getString(5));
rows.addElement(results.getString(6));
rows.addElement(results.getString(7));
rows.addElement(results.getString(8));
rows.addElement(results.getString(9));
rows.addElement(results.getString(10));
rows.addElement(new Integer(results.getInt(11)));
rows.addElement(new Integer(results.getInt(12)));
rows.addElement(new Integer(results.getInt(13)));
rows.addElement(new Integer(results.getInt(14)));
rows.addElement(new Integer(results.getInt(15)));
}
stmt.close();
dc.closeConnect();
}
catch(SQLException e)
{
System.out.println("sproject--getAllProjectB Failed!"
e.printStackTrace();
}
int len = rows.size() / 15;
String pString[][] = new String[len][15];
int mark = 0;
for(int row = 0; row < len; row++)
{
pString[row][0] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][1] = (String)rows.elementAt(mark++);
pString[row][2] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][3] = (String)rows.elementAt(mark++);
pString[row][4] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][5] = (String)rows.elementAt(mark++);
pString[row][6] = (String)rows.elementAt(mark++);
pString[row][7] = (String)rows.elementAt(mark++);
pString[row][8] = (String)rows.elementAt(mark++);
pString[row][9] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][10] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][11] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][12] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][13] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][14] =
((Integer)rows.elementAt(mark++)).toString();
}
return pString;
}
you can see there are many fields as returning result.
It gave me only 5 records in total in return.
here is the code it works but with LESS fields request:
public synchronized String[][] getAllProjectB(String office)
{
Vector rows = new Vector();
command = String.valueOf("select * from project"
try
{
con = dc.getConnect();
stmt = con.createStatement();
//results.setFetchSize(8000);
for(results = stmt.executeQuery(command); results.next();
rows.addElement(results.getString(8)))
{
rows.addElement(results.getString(2));
rows.addElement(results.getString(3));
rows.addElement(results.getString(4));
rows.addElement(results.getString(5));
rows.addElement(results.getString(6));
rows.addElement(results.getString(7));
}
stmt.close();
dc.closeConnect();
}
catch(SQLException e)
{
System.out.println("sproject--getAllProjectB Failed!"
e.printStackTrace();
}
int len = rows.size() / 7;
String pString[][] = new String[len][7];
int mark = 0;
for(int row = 0; row < len; row++)
{
pString[row][0] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][1] = (String)rows.elementAt(mark++);
pString[row][2] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][3] = (String)rows.elementAt(mark++);
pString[row][4] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][5] = (String)rows.elementAt(mark++);
pString[row][6] = (String)rows.elementAt(mark++);
}
return pString;
}
It gave me all 118 records in return.
as you can see, with less fields(half in this case) I am able to pull
all data and return them as string array.
how come? what is wrong in the code that cut the records off?
Thanks
public synchronized String[][] getAllProjectB(String office)
{
Vector rows = new Vector();
command = String.valueOf("select * from project"
try
{
con = dc.getConnect();
stmt = con.createStatement();
results.setFetchSize(8000);
for(results = stmt.executeQuery(command); results.next();
rows.addElement(new Integer(results.getInt(16))))
{
rows.addElement(results.getString(2));
rows.addElement(results.getString(3));
rows.addElement(results.getString(4));
rows.addElement(results.getString(5));
rows.addElement(results.getString(6));
rows.addElement(results.getString(7));
rows.addElement(results.getString(8));
rows.addElement(results.getString(9));
rows.addElement(results.getString(10));
rows.addElement(new Integer(results.getInt(11)));
rows.addElement(new Integer(results.getInt(12)));
rows.addElement(new Integer(results.getInt(13)));
rows.addElement(new Integer(results.getInt(14)));
rows.addElement(new Integer(results.getInt(15)));
}
stmt.close();
dc.closeConnect();
}
catch(SQLException e)
{
System.out.println("sproject--getAllProjectB Failed!"
e.printStackTrace();
}
int len = rows.size() / 15;
String pString[][] = new String[len][15];
int mark = 0;
for(int row = 0; row < len; row++)
{
pString[row][0] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][1] = (String)rows.elementAt(mark++);
pString[row][2] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][3] = (String)rows.elementAt(mark++);
pString[row][4] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][5] = (String)rows.elementAt(mark++);
pString[row][6] = (String)rows.elementAt(mark++);
pString[row][7] = (String)rows.elementAt(mark++);
pString[row][8] = (String)rows.elementAt(mark++);
pString[row][9] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][10] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][11] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][12] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][13] =
((Integer)rows.elementAt(mark++)).toString();
pString[row][14] =
((Integer)rows.elementAt(mark++)).toString();
}
return pString;
}
you can see there are many fields as returning result.
It gave me only 5 records in total in return.
here is the code it works but with LESS fields request:
public synchronized String[][] getAllProjectB(String office)
{
Vector rows = new Vector();
command = String.valueOf("select * from project"
try
{
con = dc.getConnect();
stmt = con.createStatement();
//results.setFetchSize(8000);
for(results = stmt.executeQuery(command); results.next();
rows.addElement(results.getString(8)))
{
rows.addElement(results.getString(2));
rows.addElement(results.getString(3));
rows.addElement(results.getString(4));
rows.addElement(results.getString(5));
rows.addElement(results.getString(6));
rows.addElement(results.getString(7));
}
stmt.close();
dc.closeConnect();
}
catch(SQLException e)
{
System.out.println("sproject--getAllProjectB Failed!"
e.printStackTrace();
}
int len = rows.size() / 7;
String pString[][] = new String[len][7];
int mark = 0;
for(int row = 0; row < len; row++)
{
pString[row][0] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][1] = (String)rows.elementAt(mark++);
pString[row][2] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][3] = (String)rows.elementAt(mark++);
pString[row][4] =
((String)rows.elementAt(mark++)).replace('^', '\'');
pString[row][5] = (String)rows.elementAt(mark++);
pString[row][6] = (String)rows.elementAt(mark++);
}
return pString;
}
It gave me all 118 records in return.
as you can see, with less fields(half in this case) I am able to pull
all data and return them as string array.
how come? what is wrong in the code that cut the records off?
Thanks