How to save the selected line of a Jtable in the BD?

Asked

Viewed 399 times

0

I have a JTable which fills the database, where I can select several lines at the same time with the Boolean field that has been added. I need that when you click the "record" button on mine form the lines selected in the JTable to write to the database.

imagem

I have the following code:

int id= Integer.parseInt((String)txtCidadeAtendida.getValueAt(0, 0));
String cidade = (String) txtCidadeAtendida.getValueAt(0, 1);

pst.setString(3, (String)txtCidadeAtendida.getSelectedRow());
  • Welcome to Sopt, Daivid. Do you already have some code ready? If so, edit your question and ask it to make it easier to solve your problem.

  • I have this, int id= Integer.parseint((String)txtCidadeAtendida.getValueAt(0, 0)); String city = (String) txtCidadeAtendida.getValueAt(0, 1);pst.setString(3, (String)txtCidadeAtendida.getSelectedRow());

  • Daivid, please put the code you used in the question, editing it. If possible put more information about what is occurring, if any error is appearing in any console system. And also I advise to before asking a question, to look for other equal (like this).

  • Another thing, can you persist 'anything' in the bank? Or you still don’t have the bank configured?

  • I can record normal in comics.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.