Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Change and delete rows in a sql-database

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note, some of the code could be hard to understand as a bit is in Swedish.

Hi!

I am trying to learn some sql/java. I created some tables in an sql-database, and a java-program to access and modify the tables. I am not that experienced in programming so I might have made some mistakes and I don't always know all the terminology. Anyway, here goes.

I made a GUI where you can switch from different tables using a scrollpane. I also have buttons and textfields for navigation and user input. I manged to find out how to change from different tables and how to add rows of data. I also ahve classes to run the program and classes to access to the database, and some methods in them,

This is how i show the table called Movies:


This is how I add rows to tables:



It seems a bit more complicated to delete rows and to change data in them. Mainly I am not sure how I should make the program understand which row that I want to change or delete. If it is possible to select a row in the scrollpane or somehow search in an array after the movie or staff that I want to change, I make the input using Textforms.

Any help would be great.

/Marcus

Complete code:







 
Sheriff
Posts: 21951
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is more SQL related than Swing related, I'm moving this to JDBC.
 
Marshal
Posts: 69472
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch

What happens when you try to delete a row from the command line? What SQL instructions do you use?
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic