How to make a list pass with jframe and mysql

0

How about, if you could support me it would be great, I'm creating a project about a school control in java netbeans with jframe connected to mysql command line client, but I got stuck when I went through the list, my idea is to have a jframe that asks for the ID of the student "ID_A" and when clicking on the button "Enter" in the database "ControlEscolar" in the table "Students" the field "Assistances" of the student will be increased by +1 Go earlier in the jframe.

I hope you have given me to understand, I would greatly appreciate an answer or at least if it is possible to do that, I have an idea in mind that it is with an UPDATE and a WHERE condition but I still can not make it work, I would really appreciate it.

Thanks and regards.

    
asked by AngelCruz 01.12.2017 в 00:44
source

1 answer

0

I'll mention at least 3 ways.

  • The first is with java to count the number of records you have saved in the table of the database and when you want to enter a new record you only add 1 to the counter you had previously and assign it to the id.
  • Another way would be to take all the stored ids and store them in an array or list, then create a random number and verify that it does not repeat itself in the list, later once this is achieved, you assign it to the id and send it to the database
  • You can also go to the database and place an attribute of AUTO_INCREMENT in the id field, which is automatically responsible for doing the previous 2 steps that you mentioned.
answered by 01.12.2017 в 02:36