• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Printing out ResultSet data

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys . I have created a multi client-server application. The client has a Search button which when pressed, it must tell the server to search for whatever the user has typed in a text field. The server searches from an SQL 2000 Database. Now there is a section that I am stuck at. When the server has the data...
In other words, like the following piece of code:

//Loops through all the rows returned from the query and
//writes them to the client
while (res.next()) {
int movieID = res.getInt(1);
String movieName = res.getString(2);
String movieDesc = res.getString(3);
String genre = res.getString(4);
pw.println(movieID);
pw.println(movieName);
pw.println(movieDesc);
pw.println(genre);
}

I want need help on how to print these rows to client and then putting them in a J Table with 4 Columns.
The J Table is in the client, which is why I must print them out first then client must take data and put in J Table.
I hope I am clear on my request. Thanks in advance.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Java Tutorial has a page on JTable. Have a look at it and you'll probably see what you need to do.
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic