2. TABLE OF CONTENTS
S.No Topic Page No.
1. Main Frame 3
2. Check Train
Schedule Frame
5
3. Check Seat
Availability
Frame
8
4. Book Ticket
Frame
11
5. Check Ticket
Frame
15
6. Cancel Ticket
Frame
17
7. How to create a
SQL file
19
8. How to use a SQL
file
20
3. MAIN FRAME
CODE:
//code for radio button check train schedule
Trainbtwstations a=new Trainbtwstations();
a.setVisible(true);
//code for radio button book ticket
Book d=new Book();
d.setVisible(true);
//code for radio button check availiability
Checkavailability e=new Checkavailability();
e.setVisible(true);
//code for radio button check your ticket
CheckTicket a=new CheckTicket();
a.setVisible(true);
4. //code for radio button cancel your ticket
Cancel b=new Cancel();
b.setVisible(true);
//code for exit button
System.exit(0);
18. //String query="delete from book where pnr='"+a+"' and name='"+name+"';";
int r=stmt.executeUpdate("delete from book where pnr='"+a+"';");
if(r!=0){
ResultSet rs1=stmt.executeQuery("select "+cla+" from avail where TrainNo="+tno);
int no_seat=0;
while(rs1.next()){
no_seat=rs1.getInt(1);
}
no_seat++;
int r1=stmt.executeUpdate("update avail set "+cla+"="+no_seat+" where
TrainNo="+tno);
d3.setVisible(true);
}
else
{
d2.setVisible(true);
}
}
catch(ClassNotFoundException e)
{
JOptionPane.showMessageDialog(rootPane, "ERROR");
} catch (SQLException e) {
JOptionPane.showMessageDialog(rootPane, "ERROR");
}
CODE FOR HOME BUTTON
OnlineReservation b=new OnlineReservation();
b.setVisible(true);
19. HOW TO CREATA A SQL FILE OF A
DATABASE FROM COMMAND PROMPT
This is the procedure to create a sql file from a database in mysql:
1. Open command prompt in admin mode.
2.Now change directory to the bin directory of the mysql.
3.Now type the below command in the command prompt and then enter the password of your
mysql.
4.Press enter and now you can find your database sql file in the bin folder of mysql.
20. HOW TO USE A SQL FILE FROM COMMAND
PROMPT IN ANOTHER PC
Procedure:
1.Open mysql and create database (give any name);
2.Now type command use “databasename”;
3.Now paste the .sql file in your bin folder of mysql.
4.Now open command prompt and change the directory to the bin directory of mysql.
5. now type the command as shown below