The following code returns a resultset which i am putting into Vectors and then sending them to a velocity template. The problem i am having is that each element is being padded to the sql server field length of 40 and also adding brackets at the beginning and end. For example "Billing" is displayed as [Billing + spaces till 40]. I have tried rtrim in the statement, coverting them to varchar from char and also trimming before adding to tyhe vector..Nothing is working:
preparedStatement2 = sqlserver.prepareStatement("select rtrim(CONVERT(varchar, printname) as printname from emailtypes order by printname"
rs2 = preparedStatement2.executeQuery();
Vector emailColumnNames = new Vector();
Vector roles = new Vector();
while(rs2.next())
{
Vector columnRec = new Vector();
for(int i = 1; i <= rs2.getMetaData().getColumnCount(); i++)
{
columnRec.addElement(rs2.getString("i".trim());
}
emailColumnNames.addElement(columnRec);
}
preparedStatement2 = sqlserver.prepareStatement("select rtrim(CONVERT(varchar, printname) as printname from emailtypes order by printname"
rs2 = preparedStatement2.executeQuery();
Vector emailColumnNames = new Vector();
Vector roles = new Vector();
while(rs2.next())
{
Vector columnRec = new Vector();
for(int i = 1; i <= rs2.getMetaData().getColumnCount(); i++)
{
columnRec.addElement(rs2.getString("i".trim());
}
emailColumnNames.addElement(columnRec);
}