Explain this code detail by detail like putting comments
Explain this code detail by detail like putting comments
private void table_update() {
int CC;
try {
// It is for SOMETHING ETC.***
Class.forName("com.mysql.jdbc.Driver");
con1 = DriverManager.getConnection("jdbc:mysql://localhost/linda","root","");
insert = con1.prepareStatement("SELECT * FROM record");
ResultSet Rs = insert.executeQuery();
ResultSetMetaData RSMD = Rs.getMetaData();
CC = RSMD.getColumnCount();
DefaultTableModel DFT = (DefaultTableModel) jTable1.getModel();
DFT.setRowCount(0);
while (Rs.next()) {
for (int ii = 1; ii <= CC; ii++) {
v2.add(Rs.getString("id"));
v2.add(Rs.getString("name"));
v2.add(Rs.getString("mobile"));
v2.add(Rs.getString("course"));
}
DFT.addRow(v2);
}
} catch (Exception e) {
}
}
Step by step
Solved in 2 steps