Netbeans 15 Programming with MySQL #11:UPDATE Data to MySQL Database

preview_player
Показать описание
#Netbeans #programming #MySQL #programmingtutorial
Delete data from Database

Patience is a virtue.
We need patience with this kind of work.
Please ask in the comment section for any clarification

Please watch my videos on how to connect NETBEANS 15 to MYSQL and the Login Form

Downloadable codes

Рекомендации по теме
Комментарии
Автор

Hi! I cannot update my data in my DB because have an Checkbox I don't know the code for update if there have a checkbox.

hersheyvalerieaba
Автор

My code works, but every time I update the data, all the data in the table is altered to look the same as the one that got updated. Here is my code:

public class Grade_Manager extends javax.swing.JFrame {
Connection conn = null;
PreparedStatement pst = null;
ResultSet rs = null;
/**
* Creates new form Grade_Manager
*/
public Grade_Manager() {
initComponents();
showTableData();
}

private void evt) {
String id = gradetxt1.getText();
String OVC = subjecttxt.getText();
String FirstName = firstnametxt1.getText();
String LastName = lastnametxt1.getText();
String Gender = term1txt.getText();
String Pin = term2txt.getText();
String parent1 = term3txt.getText();

String sql = "UPDATE `grades data` SET `Grade`='"+id+"', `Subject`='"+OVC+"', `first name`='"+FirstName+"', `last name`='"+LastName+"', `Term 1`='"+Gender+"', `Term 2`='"+Pin+"', `Term 3`='"+parent1+"'";
try{
pst =


pst.execute();
JOptionPane.showMessageDialog(null, "Update Successfull");

showTableData();


}
catch(Exception e){
JOptionPane.showMessageDialog(null, e);

}
}


I am not sure what i am supposed to alter:('

sithabisohlanze