Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL SERVER & VECTORS

Status
Not open for further replies.

donniea21

MIS
Feb 16, 2001
75
US
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(&quot;i&quot;).trim());
}
emailColumnNames.addElement(columnRec);
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top