Академический Документы
Профессиональный Документы
Культура Документы
This is hereby to certify that original and genuine work has been
carried to work on the matter and the related data collection and
investigation has been completed slowly, sincerely and
satisfactorily by Abhay Pratap Srivastava of class XII ‘MK’ of D.A.V
Public School BSEB Colony Patna-23 regarding his project title
“Hotel Management”
Teacher’s Signature
import java.sql.*;
import javax.swing.JOptionPane;
Connection con;
PreparedStatement pstmt;
Statement stmt;
ResultSet rs;
public Sign_up() {
initComponents();
try
{
Class.forName("java.sql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/HOTEL_MANAGEMENT","
root","root");
stmt = con.createStatement();
}catch(Exception e1){}
}
import java.sql.*;
import javax.swing.JOptionPane;
public class Login extends javax.swing.JFrame {
Connection con;
PreparedStatement pstmt;
Statement stmt;
ResultSet rs;
public Login() {
initComponents();
try
{
Class.forName("java.sql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/HOTEL_MANAGEMENT","
root","root");
stmt = con.createStatement();
}catch(Exception e1){}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
ResultSet rs=stmt.executeQuery("select * from SIGN_UP where
LOGIN_ID='"+jTextField1.getText()+"'"+" and
PASSWORD='"+jPasswordField1.getText()+"'");
if(rs.next())new CUSTOMER_DETAILS().show();
else JOptionPane.showMessageDialog(this,
"Invalid.","MyDialog",JOptionPane.ERROR_MESSAGE );
}catch(Exception e2){}
}
Screenshot!!! LOGIN
// src code for Room Detail
import java.sql.*;
import javax.swing.JOptionPane;
public class Room_DETAILS extends javax.swing.JFrame {
Connection con;
PreparedStatement pstmt;
Statement stmt;
ResultSet rs;
public Room_DETAILS() {
initComponents();
try
{
Class.forName("java.sql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/HOTEL_MANAGEMENT","
root","root");
stmt = con.createStatement();
}catch(Exception e1){}
}
)
private void t2ActionPerformed(java.awt.event.ActionEvent evt)
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
pstmt = con.prepareStatement("insert ROOM_DETAILS values ('" + t1.getText() + "','"
+ t2.getSelectedItem() + "','" + t3.getSelectedItem() + "','" + t5.getText() + "','" +
t4.getSelectedItem() + "')");
pstmt.executeUpdate();
JOptionPane.showMessageDialog(this,
"success","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}catch(Exception e2){} // TODO add your handling code here:
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
pstmt = con.prepareStatement("update ROOM_DETAILS set ROOM TYPE = '" +
t2.getSelectedItem() + "', AC FACILITY = '" + t3.getSelectedItem() + "',ROOM FARE =
'"+t5.getText() + "' where ROOM_NO = '" + t1.getText() + "'" );
pstmt.executeUpdate();
JOptionPane.showMessageDialog(this,
"success","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}catch(Exception e2){}
}
Screenshot!!! Room details
// src code for consumer detail
import java.sql.*;
import javax.swing.JOptionPane;
public class CUSTOMER_DETAILS extends javax.swing.JFrame {
Connection con;
PreparedStatement pstmt;
Statement stmt;
ResultSet rs;
public CUSTOMER_DETAILS() {
initComponents();
try
{
Class.forName("java.sql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/HOTEL_MANAGEMENT","
root","root");
stmt = con.createStatement();
}catch(Exception e1){}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
if(jTextField1.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField2.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextArea1.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField3.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField4.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField5.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField6.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField3.getText().length() != 10)
{
JOptionPane.showMessageDialog(this, "MOBILE NO. IS
INVALID","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else
{
try
{
pstmt = con.prepareStatement("insert customer_details values
('"+jTextField1.getText() + "','" + jTextField2.getText() + "','" + jTextArea1.getText()
+"','" + jTextField3.getText() + "','" + jTextField4.getText() + "','" +
cb1.getSelectedItem()+"','"+ cb2.getSelectedItem()+ "','"+ jTextField5.getText()
+"','"+ jTextField6.getText()+ "')");
pstmt.executeUpdate();
JOptionPane.showMessageDialog(this,
"success","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
catch(Exception e2){}
}
}