I have an error :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tbldetailbrgmasuk.nonota=''' at line 1
this my coding :
String data[]=new String[6];
private void setDefaultTable() {
String stat ="";
try {
Class.forName(driver);
Connection kon = DriverManager.getConnection(database,user,pass);
Statement stt = kon.createStatement();
String SQL = "SELECT tblbarang.kodebarang,tblbarang.namabarang,tblbaran g.hargajual," + "tblbarang.stok,tbldetailbrgmasuk.jumlah,tbldetail brgmasuk.subtotal,tblbrgmasuk.nonota " +"FROM tblbarang,tbldetailbrgmasuk,tblbrgmasuk WHERE tblbarang.kodebarang=tbldetailbrgmasuk.kodebarang " +
"AND tblbrgmasuk.nonota=tbldetailbrgmasuk.nonota" +
"AND tbldetailbrgmasuk.nonota='"+NoNota.getText()+"'";
ResultSet res = stt.executeQuery(SQL);
while(res.next()){
data[0] = res.getString(1);
data[1] = res.getString(2);
data[2] = res.getString(3);
data[3] = res.getString(4);
data[4] = res.getString(5);
data[5] = res.getString(6);
tableModel.addRow(data);
}
res.close();
stt.close();
kon.close();
} catch (Exception ex) {
System.err.println(ex.getMessage());
}
}