Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Appending records to a text area

 
Enock Banacson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone throw some light
//My program display some silly results. I put the following statement:
"SELECT * FROM Reports WHERE DateOfPurch = '"+jtfDate.getText().trim()+"'";
//then tell it to append those results to a text area using the following:
int result = new StringBuffer();
ResultSetMetaData metaData = rst.getMetaData();
int numberOfColumns = metaData.getColumnCount();
for(int i = 1; i <= numberOfColumns; i++)
result.append(metaData.getColumnName(i)+"\t");
result.append("\n");
while(rst.next())
{
for(int i = 1; i <= numberOfColumns; i++)
result.append(rst.getObject(i)+"\t");
result.append("\n");
}
//but after the third column it starts displaying data in an unordely manner i.e. leaving some unneccessary spaces.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enock. Unfortunately your question does not deal with Servlets, which is the topic for this forum. I am going to move this to the Java Beginner's forum since you already have posted there, and this question will match the topic there.
Please refrain from posting into inappropriate forums. Also to let you know, there is a "CODE" tag that will keep your code formatted with indentation, etc,, that makes your code easier to read and therefore easier for us to help you. The "CODE" tag can be created by clicking on the CODE button below the Add Reply button when posting.
Thanks and good luck.
Mark
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use *code* tags.
This is confusing me.

Do you mean to say this:

or this?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic