aspose file tools*
The moose likes Beginning Java and the fly likes Appending records to a text area Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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: 17249
    
    6

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: 984

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://aspose.com/file-tools
 
subject: Appending records to a text area
 
Similar Threads
Best way to handle huge write operation
MySQL problem
Displaying Multiple Columns And Records from database.
mysql and java application:characters not displaying right
JDBC returning values using Scientific Notation