-
Notifications
You must be signed in to change notification settings - Fork 1
/
JobCardDel.java
94 lines (70 loc) · 2.39 KB
/
JobCardDel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.io.*;
class JobCardDel extends JFrame implements ActionListener
{
JInternalFrame iFrameJobCardDel = new JInternalFrame("Delete Job Card Info",true,true,true,true);
Connection con;
Statement stmt;
ResultSet rs;
LayoutManager lm = null;
JTextField JobCardDel_Id = new JTextField(10);
JButton Delete = new JButton("Delete");
public JobCardDel()
{
}
public JInternalFrame JobCardDelFrame(JDesktopPane desktop)
{
iFrameJobCardDel.setLayout(lm);
iFrameJobCardDel.setLocation(25,25);
iFrameJobCardDel.setSize(300,80);
Border border = new CompoundBorder(new BevelBorder(BevelBorder.RAISED),new EtchedBorder(EtchedBorder.RAISED));
iFrameJobCardDel.setBorder(border);
JLabel l_JobCardDel_Id =new JLabel("Job Card ID :");
l_JobCardDel_Id.setBounds(20,15,110,20);
iFrameJobCardDel.add(l_JobCardDel_Id);
JobCardDel_Id.setBounds(120,15,60,20);
iFrameJobCardDel.add(JobCardDel_Id);
Border border12 = new CompoundBorder(new BevelBorder(BevelBorder.RAISED),new EtchedBorder(EtchedBorder.RAISED));
Delete.setBounds(190,15,100,20);
iFrameJobCardDel.add(Delete);
Delete.setBorder(border12);
Delete.addActionListener(this);
desktop.add(iFrameJobCardDel);
return(iFrameJobCardDel);
//iFrameJobCardDel.show();
}
public void actionPerformed(ActionEvent e)
{
String delstr = JobCardDel_Id.getText();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:JMS");
int custstr = Integer.parseInt(delstr);
String query = "DELETE * FROM Job_Card E WHERE E.Job_ID = "+custstr;
stmt = con.createStatement();
int result = stmt.executeUpdate ( query );
System.out.println("result = "+result);
if(result==1)
{
JOptionPane.showMessageDialog(this,"The Job Card Record Deleted");
iFrameJobCardDel.setVisible(false);
return;
}
if(result==0)
{
JOptionPane.showMessageDialog(this,"The Job Card Record Not Found Try Again.");
return;
}
}
catch(Exception ae)
{
ae.printStackTrace();
}
//Addenq1 p = new Addenq1();
}
}