This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Appending records to a text area Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Appending records to a text area" Watch "Appending records to a text area" New topic
Author

Appending records to a text area

Enock Banacson
Greenhorn

Joined: Sep 30, 2003
Posts: 8
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

Joined: Feb 05, 2001
Posts: 17234
    
    1

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 965

Please use *code* tags.
This is confusing me.

Do you mean to say this:

or this?


Please ignore post, I have no idea what I am talking about.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Appending records to a text area
 
Similar Threads
mysql and java application:characters not displaying right
Best way to handle huge write operation
Displaying Multiple Columns And Records from database.
MySQL problem
JDBC returning values using Scientific Notation