0% found this document useful (0 votes)
161 views10 pages

SQL QUERIES For Railway Reservation Program

The document provides instructions for creating tables, inserting values, and connecting to an Oracle database from Visual Basic. It includes steps to: 1) Create three tables (TRAINNO, TRAINDETAILS, BOOKING) to store train schedule and booking data using SQL commands. 2) Insert sample values into the TRAINNO and TRAINDETAILS tables by running SQL INSERT statements with prompted input values. 3) Configure an ODBC data source in Windows Control Panel to connect to an Oracle database using the TNS service name and credentials. 4) Set the data source properties of two ADODC controls in a Visual Basic form to retrieve data from the TRAINNO and TRAINDETAILS tables via the new ODB

Uploaded by

Sowmya M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
161 views10 pages

SQL QUERIES For Railway Reservation Program

The document provides instructions for creating tables, inserting values, and connecting to an Oracle database from Visual Basic. It includes steps to: 1) Create three tables (TRAINNO, TRAINDETAILS, BOOKING) to store train schedule and booking data using SQL commands. 2) Insert sample values into the TRAINNO and TRAINDETAILS tables by running SQL INSERT statements with prompted input values. 3) Configure an ODBC data source in Windows Control Panel to connect to an Oracle database using the TNS service name and credentials. 4) Set the data source properties of two ADODC controls in a Visual Basic form to retrieve data from the TRAINNO and TRAINDETAILS tables via the new ODB

Uploaded by

Sowmya M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

SQL QUERIES FOR ORACLE 9i:

TO CREATE THE TABLE TRAINNO:


SQL> CREATE TABLE TRAINNO (SRC VARCHAR2 (15), DEST VARCHAR2 (15),
TRAINNO NUMBER);
Table created.
SQL> DESC TRAINNO;
Name Null? Type
----------------------------------------- -------- ----------------------------
SRC VARCHAR2(15)
DEST VARCHAR2(15)
TRAINNO NUMBER

TO CREATE THE TABLE TRAINDETAILS:


SQL> CREATE TABLE TRAINDETAILS (TRAINNO NUMBER, SRC VARCHAR2 (15),
DEST VARCHAR2 (15), ARRTIME NUMBER, DEPTIME NUMBER, CPP NUMBER,
TOTSEATS NUMBER, SEATSBOOKED NUMBER, SEATSAVAIL NUMBER);
Table created.
SQL> DESC TRAINDETAILS;
Name Null? Type
----------------------------------------- -------- ----------------------------
TRAINNO NUMBER
SRC VARCHAR2(15)
DEST VARCHAR2(15)
ARRTIME NUMBER
DEPTIME NUMBER
CPP NUMBER
TOTSEATS NUMBER
SEATSBOOKED NUMBER
SEATSAVAIL NUMBER
TO CREATE THE TABLE BOOKING:
SQL> CREATE TABLE BOOKING (BOOKID VARCHAR2 (15), TRAINNO NUMBER,
NAME VARCHAR2 (15), SRC VARCHAR2 (3), DEST VARCHAR2 (3), ARRTIME
NUMBER, DEPTIME NUMBER, DOJ DATE, NOS NUMBER, CPP NUMBER,
STUDENT VARCHAR2 (15), COLLEGE VARCHAR2 (50), TOT NUMBER);
Table created.
SQL> DESC BOOKING;
Name Null? Type
----------------------------------------- -------- ----------------------------
BOOKID VARCHAR2(15)
TRAINNO NUMBER
NAME VARCHAR2(15)
SRC VARCHAR2(3)
DEST VARCHAR2(3)
ARRTIME NUMBER
DEPTIME NUMBER
DOJ DATE
NOS NUMBER
CPP NUMBER
STUDENT VARCHAR2(15)
COLLEGE VARCHAR2(50)
TOT NUMBER

TO ENTERING VALUES INTO TABLE:


FOR TRAINNO TABLE:
SQL> INSERT INTO TRAINNO VALUES ('&SRC','&DEST', &TRAINNO);
Enter value for src: AHM
Enter value for dest: CBT
Enter value for trainno: 1116
old 1: INSERT INTO TRAINNO VALUES('&SRC','&DEST',&TRAINNO)
new 1: INSERT INTO TRAINNO VALUES('AHM','CBT',1116)

1 row created.
To enter the next value, press front slash(/) and press enter.
SQL> /

TO ENTER THE VALUES OF TRAINDETAILS:


SQL> INSERT INTO TRAINDETAILS VALUES (&TRAINNO, '&SRC', '&DEST',
&ARRTIME, &DEPTIME, &CPP, &TOTSEATS, &SEATSBOOKED, &SEATSAVAIL);
Enter value for trainno: 1103
Enter value for src: SLM
Enter value for dest: BAN
Enter value for arrtime: 10.15
Enter value for deptime: 10.45
Enter value for cpp: 240
Enter value for totseats: 100
Enter value for seatsbooked: 0
Enter value for seatsavail: 100
old 1: INSERT INTO TRAINDETAILS
VALUES(&TRAINNO,'&SRC','&DEST',&ARRTIME,&DEPTIME,&CPP,&TOTSEATS,&S
new 1: INSERT INTO TRAINDETAILS
VALUES(1103,'SLM','BAN',10.15,10.45,240,100,0,100)

1 row created.
To enter the next value:
SQL> /
To create DSN in control Panel:
1. GoTo control panel and select Administrative Tools .
2. Select DataSources(ODBC).
3. Click Add Button.
4. Now select Oracle in OraHome9. (It may vary to your system ammu..) It may
be oracle in OraHome90 in your system.

5. Click finish button.


6. Now give the Data source name, TNS service name, User ID.
The TNS service name also varies in your system ammu. In your system, it
may be oracle or else.
Click the Test Connection button. Now This window will be open.

Type the password as tiger and click OK. Now the connection is successful
message will come.

Now click Ok.


Open your visual basic Railway reservation project.
In form, frmTrainEnquiry right click on the train number ADODC control
and select properties.

Now select the DSN name from combo box which we already created using
control panel:
Click Authentication tab and enter
User name: scott
Password : tiger
Then select Record source tab and do the following:

Click OK.
Then select Traindetails ADODC control. Right click on the control and
select ADODC properties.
Now select the DSN name from combo box which we already created using
control panel:

Click Authentication tab and enter


User name: scott
Password : tiger
Then select Record source tab and do the following:

Click OK.
Then Set the Data source, data field properties for all the controls.. That’s it.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy