• 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

Swing tables & SQL Server Database (How to combine both)

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I'm the new guy here and my question is as follows:

I'm currently working on a project to give students grades using a java application and working with the ModelViewController design pattern. Right now what I'm facing is a new page where I can manually edit a students grades (based off their studentID in the database). The idea is that I would have a database such as tableStudents(StudentID, Course, Grades(0-20)).
I'd like to get an editable table in the form where I can get the Course field and the Grades field (based on studentID which will be selectable from a list on the top of the page).

My first thought would be to use my database-access-class which has a "executeSelectCommand( String query )" which returns a "ResultSet rs" that I can loop through. But I don't have the slightest idea of how to get that resultset into a table nor how to add the modified table back into the database.

The problem is I have only started learning java at the beginning of this semester so I'm quite new to Swing and it's components. Could anyone help me figure how to create an editable table in my form that can be written into the database?

Thank you in advance!
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I presume you now all about JDBC already. Then you can take the data from the database and create a table. I think you will find it all in the tutorial.
For connecting to SQL Server, start here.
 
Stijn Jonckheere
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi and thanks

I do know about JDBC, I already have 3 pages in this java app that gets data from the database so connecting has happened a while back. Creating an editable table from that received resultset on the other hand is entirely new
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Creating an editable table from that received resultset on the other hand is entirely new



See Table From Database for some ideas.
reply
    Bookmark Topic Watch Topic
  • New Topic