}
private void jButton2SIMPANActionPerformed(java.awt.event.ActionEvent
evt) {
// TODO add your handling code here:
try {
koneksidatabase();
sql="insert into supplier
values('"+V_kodesupplier.getText()+"','"+v_namasupplier.getText()+"','"+v_alamatsupplier.getText()+"','"+v_telpsupplier.getText()+"')";
stat.execute(sql);
bersih_form();
} catch (Exception e) {
JOptionPane.showMessageDialog(null,
e);
}
}
private void jButton1EDITActionPerformed(java.awt.event.ActionEvent evt)
{
// TODO add your handling code here:
try {
koneksidatabase();
sql="update supplier set
nama_supplier='"+v_namasupplier.getText();
} catch (Exception e) {
}
}
private void jButton3HAPUSActionPerformed(java.awt.event.ActionEvent
evt) {
// TODO add your handling code here:
try {
koneksidatabase();
sql="delete from supplier
where kode_supplier='"+V_kodesupplier.getText()+"'";
stat.execute(sql);
bersih_form();
} catch (Exception e) {
JOptionPane.showMessageDialog(null,
e);
}
}
private void jButton4KELUARActionPerformed(java.awt.event.ActionEvent
evt) {
// TODO add your handling code
here:
this.dispose();
}
private void V_kodesupplierActionPerformed(java.awt.event.ActionEvent
evt) {
// TODO add your handling code here:
try {
koneksidatabase();
sql ="select*from supplier
where kode_supplier='"+V_kodesupplier.getText()+"'";
rs = stat.executeQuery(sql);
while (rs.next())
{
v_namasupplier.setText(rs.getString("nama_supplier"));
v_alamatsupplier.setText(rs.getString("alamat_supplier"));
v_telpsupplier.setText(rs.getString("telp_supplier"));
}
} catch (Exception e) {
}
}
private void v_telpsupplierActionPerformed(java.awt.event.ActionEvent
evt) {
// TODO add your handling code here:
}
private void v_namasupplierActionPerformed(java.awt.event.ActionEvent
evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
private void koneksidatabase()
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbc");
con = DriverManager.getConnection("Jdbc:Odbc:dsprogram");
stat = con.createStatement();
} catch (Exception e) {
JOptionPane.showMessageDialog(null,"Kesalahan"+e);
}
}
private void bersih_form()
{
V_kodesupplier.setText("");
v_namasupplier.setText("");
v_alamatsupplier.setText("");
v_telpsupplier.setText("");
V_kodesupplier.requestFocus();
}
No comments:
Post a Comment