• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Stijn Jonckheere
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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!
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!