VB, Rdbms (2) 1
VB, Rdbms (2) 1
2
3
4
5
6
VISUAL BASIC
7
EX.NO : 01
CALCULATOR
DATE :
AIM:
ALGORITHM:
Step 3 : Place the appropriate controls on the form (text box, command buttons and set
8
INPUT:
9
CODING:
Dim T As Double
Dim OP As String
10
OUTPUT:
RESULT:
11
EX.NO : 02
a. FIBONACCI SERIES
DATE :
AIM:
ALGORITHM:
Step 3 : Place the appropriate controls on the form (text box, command buttons, list box
Step 4 : The coding for accepting input from the user through input box and generating
12
INPUT :
CODING:
13
OUTPUT:
RESULT:
14
EX.NO : 02
b. SUM OF N NUMBERS
DATE :
AIM:
ALGORITHM:
Step 3 : Place the appropriate controls on the form (text box and command buttons)
Step 5 : The coding using for loop to find the sum of 'n' numbers is written.
15
CODING:
Dim i, s, n As Integer
16
OUTPUT:
RESULT:
AIM:
To create a program MDI from and develop a menu driven program to arrange the
forms in cascading and horizontal styles and also change the color of the form.
ALGORITHM:
Step 4 : Create the appropriate main menus and sub menus using editor.
Step 5 : And also the coding is written to change the color of the form.
Step 6 : The coding is written for each events to arrange the form in horizontal or in
cascade style.
18
Input:
19
CODING:
20
Output:
21
RESULT:
22
EX.NO : 04
DRIVELISTBOX, DIRLISTBOX AND
DATE : FILE LISTBOX CONTROLS
AIM:
To write a program to display files in a directory using Drive list box,Dir list
Box and file list box .control and open, edit ,save text file using Rich text box control.
ALGORITHM:
Step 2: Add drive link, file and directory controls in your form.
23
INPUT:
24
CODING:
25
OUTPUT:
RESULT:
26
EX.NO : 05
MENU USING COMMON DIALOG CONTROL
DATE :
AIM:
To create a program using common dialog control to display the font, save and open
dialog box without using the action control property.
ALGORITHM:
Step 3: Place the appropriate controls on the from (text box, command buttons and
27
INPUT:
28
CODING:
OUTPUT:
29
RESULT:
AIM:
ALGORITHM:
Step 3 : Place the appropriate controls on the form (timer, picture box and command
button)
Step 6 : Write the coding for generating animation of images using timer.
31
INPUT:
CODING:
Private Sub Command1_Click()
End
End Sub
End If
End Sub
32
OUTPUT:
RESULT:
33
EX.NO : 07
NUMBER CONVERSION
DATE :
AIM:
To create a program for accept a number as input and convert them into BINARY,
OCTAL, HEXADECIMAL.
ALGORITHM:
Step 3 : Place appropriate controls on the form (label boxes, command buttons, text
boxes)
Step 5 : The coding for conversion of decimal number to binary, octal & hexadecimal
written for each event in which decimal number is given as input in the text
box.
34
INPUT:
35
CODING:
Dim A As Integer
Dim B As Integer
36
If A = 0 Then
Text2.Text = Text2.Text
Else
Text2.Text = A & Text2.Text
End If
End Sub
OUTPUT:
RESULT:
37
EX.NO : 8
STUDENT MARK LIST
DATE :
AIM:
ALGORITHM:
Step 3: The student table is created using create table student query with
student_id, name, class, mark, total and percentage fields.
Step 4: The values are inserted in student table using INSERT command.
Step 5: In order to view the student record select * from student query is used.
Step 6: To use the Visual basic as front end, click on Start → All Programs →
Microsoft Visual basic 6.0 – New Project.
Step 7: Select 7- labels, 7- Text boxes, 4- Command buttons and 1- adodc control
by place them in the form design window.
Step 8: Change the caption for the controls using properties window.
Step 9: If add command button is clicked, all the text box values are cleared
and it will be ready to accept new values.
38
Step 10: If save command button is clicked, save the record in database after entering
student details.
Step 11: If delete command button is clicked, data base the student values will be
deleted from data base.
Step 12: Open the code editor window and write appropriate coding.
Step 13: Run the project using start icon from toolbar and save the form write
39
INPUT:
40
ORACLE CODING:
Table created.
1 row created.
41
MsgBox "record saved"
End Sub
42
OUTPUT:
43
ORACLE
44
EX.NO : 08
EMPLOYEE DETAILS
DATE :
AIM:
To create an EMPLOYEE table with necessary fields and perform any one Logical,
ALGORITHM:
Step 2: Create a table EMPLOYEE with the following fields Empno, name by using create
Step 5: Execute any one Logical, Comparison, Group, Sort and Set statements.
45
CODING:
number(3),salary number(5));
Table created.
number(3),salary number(5));
Table created.
1 row created.
46
SQL> insert into emp1 values(&empno,'&name','&designation','&GENDER',&age,&salary);
1 row created.
1 row created.
47
SQL> insert into emp2 values(&empno,'&name','&designation','&GENDER',&age,&salary);
1 row created.
1 row created.
48
Enter value for empno: 105
1 row created.
49
SQL>select * from emp1 union select * from emp2;
NAME SUM(SALARY)
tamil 45000
venkat 50000
naveen 1000
50
EX.NO : 09
INVENTORY SYSTEM
DATE :
AIM:
To write PL/SQL program to update rate filed by 20% more. Alter table by adding a field no
ALGORITHM:
Step 2: Create a table INVENTORY with fields prono, proname and rate.
Step 4: Create a PL/SQL code to modify the VALUES of the column rate by 20%.
Step 6: Set VALUES for the no of items field using UPDATE command.
51
CODING:
Table created.
PRONAME VARCHAR2(15)
RATE NUMBER(7,2)
1 row created.
SQL> /
1 row created.
52
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
53
SQL> SELECT * FROM inventory;
102 ac 10000
SQL> declare
2 begin
4 end;
5/
102 ac 12000
54
SQL> ALTER TABLE inventory ADD(no_of_items number(5));
Table altered.
1 row updated.
1 row updated.
1 row updated.
1 row updated.
1 row updated.
102 ac 12000 7
55
EX.NO : 10
BEFORE DATABASE TRIGGER
DATE :
AIM:
system.
ALGORITHM:
Step 2: CREATE TABLE PMASTER with the necessary fields and set pno as PRIMARY
KEY.
Step 3: Create a table PTRANS with the necessary fields and set tno as PRIMARY KEY and
Step 4: Create a TRIGGER pm for PMASTER table to check NULL VALUES of the
Step 5: Create a TRIGGER pt for PTRANS table to check the capacity not less than or equal
56
CODING:
varchar2(15),rate number(7,2));
Table created.
number(3));
Table created.
SQL> create or replace trigger pm before insert or update on pmaster for each row
2 declare
4 begin
7 end if;
8 end;
9/
Trigger created.
57
SQL> create or replace trigger pt before insert or update on ptrans for each row
2 declare
4 begin
5 if :new.pavail<=0 then
7 end if;
8 end;
9/
Trigger created.
58
INSERT INTO pmaster VALUES(101,'',3000) *
ERROR at line 1:
ERROR at line 1:
59
EX.NO : 11
PROCEDURES
DATE :
AIM:
ALGORITHM:
60
CODING:
varchar2(20));
Table created.
3 is
4 begin
6 end;
7/
Procedure created.
NAME VARCHAR2(20)
61
SQL> declare
2 v_id user.id%type:=&id;
3 v_name user.name%type:='&name';
4 begin
5 insert user(vid,vname);
6 end;
7/
ID NAME
1 deepak
62
SQL>insert into user values(&id,'&name');
1 row created.
1 row created.
ID NAME
1 deepak
2 akkas
3 karan
63
EX.NO : 12
STUDENT MARK LIST
DATE :
AIM:
To write a VB program to manipulate the student mark list with oracle database connectivity
program.
ALGORITHM:
Step 3: The student table is created using create table student query with student_id, name, class,
mark, total and percentage fields.
Step 4: The values are inserted in student table using INSERT command.
Step 5: In order to view the student record select * from student query is used.
Step 6: To use the Visual basic as front end, click on Start → All Programs → Microsoft Visual basic
6.0 – New Project.
Step 7: Select 7 labels, 7 Text boxes, 4 Command buttons and 1 adodc 1 control by place them in the
form design window.
Step 8: Change the caption for the controls using properties window.
Step 9: If add command button is clicked, all the text box values are cleared and it will be ready to
accept new values.
Step 10: If save command button is clicked, save the record in database after entering student details.
Step 11: If delete command button is clicked, data base the student values will be deleted
from data base.
Step 12: Open the code editor window and write appropriate coding.
Step 13: Run the project using start icon from toolbar and save the form write (.frm) & project with
(.vbp) extension.
64
INPUT:
65
ORACLE CODING:
Table created.
1 row created.
66
MsgBox "record saved"
End Sub
67
RESULT:
68