-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBillingDel.java
94 lines (70 loc) · 2.39 KB
/
BillingDel.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 BillingDel extends JFrame implements ActionListener
{
JInternalFrame iFrameBillingDel = new JInternalFrame("Delete Billing Info",true,true,true,true);
Connection con;
Statement stmt;
ResultSet rs;
LayoutManager lm = null;
JTextField BillingDel_Id = new JTextField(10);
JButton Delete = new JButton("Delete");
public BillingDel()
{
}
public JInternalFrame BillingDelFrame(JDesktopPane desktop)
{
iFrameBillingDel.setLayout(lm);
iFrameBillingDel.setLocation(25,25);
iFrameBillingDel.setSize(300,80);
Border border = new CompoundBorder(new BevelBorder(BevelBorder.RAISED),new EtchedBorder(EtchedBorder.RAISED));
iFrameBillingDel.setBorder(border);
JLabel l_BillingDel_Id =new JLabel("Bill Number :");
l_BillingDel_Id.setBounds(20,15,110,20);
iFrameBillingDel.add(l_BillingDel_Id);
BillingDel_Id.setBounds(120,15,60,20);
iFrameBillingDel.add(BillingDel_Id);
Border border12 = new CompoundBorder(new BevelBorder(BevelBorder.RAISED),new EtchedBorder(EtchedBorder.RAISED));
Delete.setBounds(190,15,100,20);
iFrameBillingDel.add(Delete);
Delete.setBorder(border12);
Delete.addActionListener(this);
desktop.add(iFrameBillingDel);
return(iFrameBillingDel);
//iFrameBillingDel.show();
}
public void actionPerformed(ActionEvent e)
{
String delstr = BillingDel_Id.getText();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:JMS");
int custstr = Integer.parseInt(delstr);
String query = "DELETE * FROM Billing E WHERE E.Bill_No = "+custstr;
stmt = con.createStatement();
int result = stmt.executeUpdate ( query );
System.out.println("result = "+result);
if(result==1)
{
JOptionPane.showMessageDialog(this,"The Billing Record Deleted");
iFrameBillingDel.setVisible(false);
return;
}
if(result==0)
{
JOptionPane.showMessageDialog(this,"The Billing Record Not Found Try Again.");
return;
}
}
catch(Exception ae)
{
ae.printStackTrace();
}
//Addenq1 p = new Addenq1();
}
}