S
sahm
I can not get data from Table cell
Hi every one
I try to get String from cell in jTable
every time I try to get data from cell I only get null
and this is my code
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Class.forName("com.mysql.jdbc.Driver");
Connection con;
con = DriverManager.getConnection("jdbc:mysql://localhost/
uni","root","java");
Statement stat = con.createStatement();
ResultSet result;
result = stat.executeQuery("select max(no) from student_info_table");
result.next();
int mx, c;
mx = result.getInt(1);
mx = mx +1;
String inserting_Data = "insert into fee_part_table (feeNO, feeParts,
fee_1st_part) values(?, ?, ?)";
PreparedStatement ps = null;
ps = con.prepareStatement(inserting_Data);
ps.setInt(1, mx);
ps.setInt(2, c);
String st;
st = String.valueOf(jTable2.getValueAt(0, 0));
JOptionPane.showMessageDialog(this, st);
ps.setString(3, String.valueOf(jTable2.getValueAt(0, 0)));
ps.executeUpdate();
///////////////////////////////////////////////
Hi every one
I try to get String from cell in jTable
every time I try to get data from cell I only get null
and this is my code
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Class.forName("com.mysql.jdbc.Driver");
Connection con;
con = DriverManager.getConnection("jdbc:mysql://localhost/
uni","root","java");
Statement stat = con.createStatement();
ResultSet result;
result = stat.executeQuery("select max(no) from student_info_table");
result.next();
int mx, c;
mx = result.getInt(1);
mx = mx +1;
String inserting_Data = "insert into fee_part_table (feeNO, feeParts,
fee_1st_part) values(?, ?, ?)";
PreparedStatement ps = null;
ps = con.prepareStatement(inserting_Data);
ps.setInt(1, mx);
ps.setInt(2, c);
String st;
st = String.valueOf(jTable2.getValueAt(0, 0));
JOptionPane.showMessageDialog(this, st);
ps.setString(3, String.valueOf(jTable2.getValueAt(0, 0)));
ps.executeUpdate();
///////////////////////////////////////////////