-
Notifications
You must be signed in to change notification settings - Fork 1
/
Chiropractors.java
154 lines (90 loc) · 4.25 KB
/
Chiropractors.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package business;
import java.sql.*;
/**
*
* @author Kevin
*/
public class Chiropractors {
private String chiroprac_id;
private String firstName;
private String lastName;
private String email;
private String office_num;
private String admin_id;
public Chiropractors() {
chiroprac_id="";
firstName="";
lastName="";
email="";
office_num="";
admin_id="";
}
public Chiropractors(String i, String fn, String ln, String ed, String ap, String ad) {
chiroprac_id=i;
firstName=fn;
lastName=ln;
email=ed;
office_num=ap;
admin_id= ad;
}
/*********************************************************************
*
* The selectDB gets dentist info from database
*
*******************************************************************/
public void selectDB(String i) {
chiroprac_id=i;
try { //Load DB Driver
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection con1 = DriverManager.getConnection("jdbc:ucanaccess://C:/Users/Kevin/Downloads/ChiropractorOfficeMDB.accdb");
//Execute SQL Statement
Statement stmt =con1.createStatement();
String sql = "Select * from Chiropractors where chiroprac_id='"+getchiroprac_id()+"'";
//Process ResultSet
System.out.println(sql);
ResultSet rs = stmt.executeQuery(sql);
rs.next();
//Not sure why I had to number them out of order
//had to unorganize so they would show up correctly when displayed
setfirstName(rs.getString(1));
setlastName(rs.getString(2));
setemail(rs.getString(4));
setoffice_num(rs.getString(3));
setadmin_id(rs.getString(6));
}
catch(Exception se) {
System.out.println(se);
}
} //end selectDB()
public String getchiroprac_id() { return chiroprac_id; }
public void setchiroprac_id(String i) { chiroprac_id=i; }
public String getfirstName() { return firstName; }
public void setfirstName(String fn) { firstName=fn; }
public String getlastName() { return lastName; }
public void setlastName(String ln) { lastName=ln; }
public String getemail() { return email; }
public void setemail(String ed) { email=ed; }
public String getoffice_num() { return office_num; }
public void setoffice_num(String ap) { office_num=ap; }
public String getadmin_id() { return admin_id; }
public void setadmin_id(String ad) { admin_id=ad; }
public void display() {
System.out.println("ID = "+ chiroprac_id);
System.out.println("First Name = "+ firstName);
System.out.println("Last Name = "+ lastName);
System.out.println("Email = "+ email);
System.out.println("Office = "+ office_num);
System.out.println("Admin id = " + admin_id);
}
public static void main(String args[]) {
Chiropractors c1;
c1 = new Chiropractors();
c1.selectDB("C510");
c1.display();
}
}