Sunteți pe pagina 1din 81

DATA DEFINITION,TABLE CREATION AND CONSTRAINTS

AIM To execute and verify the Basic SQL commands. PROCEDURE STEP 1: Start STEP 2: Create the table with its essential attributes. STEP 3: Insert attribute values into the table. STEP 4: Create the view from the above created table. STEP 5: Execute different Commands. STEP 6: Stop

CREATING A TABLE: SQL>create table student(reg_no number(2),name varchar(6),dept number(1),mark_1_number(3),mark_2 number(3),tot number(3),avg number(3)); Table created. DESCRIBE TABLE: SQL>desc student; Name REG_NO NAME DEPT SEM MARK_1 MARK_2 TOT AVG INSERTING VALUES INTO THE TABLE: SQL>insert into student values(001,harish,IT,50,60,110,55); 1 row created. SQL>insert into student values(002,rohit,ECE,1,60,70,230,65); 1 row created. SQL>insert into student values(003,thomas,EEE,1,70,80,150,75); 1 row created. SQL>insert into student values(004,sunitha,CSC,1,80,90,170,85); 1 row created. SQL>select *from student; REG_NO 1 2 3 4 NAME DEP harish rohit thomas sunitha IT ECE EEE CSE 1 1 SEM 1 1 MARK_1 50 60 70 80 90 MARK_2 60 70 80 TOT 110 230 150 170 85 65 75 AVG 55 Null? Type NUMBER(2) VARCHAR2(6) VARCHAR2(3) NUMBER(1) NUMBER(3) NUMBER(3) NUMBER(3) NUMBER(3) varchar(3),sem

ALTER TABLE: SQL>alter table student add primary key(reg_no); Table altered. CONSTRAINTS; SQL> insert into student values(001,harish,IT,1,50,60,110,55) insert into student values(001,harish,IT,1,50,60,110,55) ERROR at line 1: ORA-00001:unique constraint(SCOTT.SYS_C001273)violated FOREIGN KEY: Create table book(isbn number(10),book_name student(reg_no)on delete cascade); Table created. SQL>insert into book values(775,discover of India,001); 1 row created. SQL> insert into book values(222,julius ceaser,002); 1 row created. SQL> insert into book values(454,paradise lost,003); 1 row created. SQL> insert into book values(369,wings of fire,004); 1 row created.
OUTPUT:

varchar(20),reg_no

number(2)

references

ISBN

BOOK_NAME

REG_NO

775 222 454 369

discovery of india julius ceaser paradise lost wings of fire

1 2 3 4

SQL>select *from student REG_NO 1 2 3 4 NAME DEP harish rohit IT ECE 1 1 SEM 1 1 MARK_1 50 60 70 80 MARK_2 60 70 80 90 TOT 110 230 150 170 65 75 85 AVG 55

thomas EEE sunitha CSE

SQL>delete from student where reg_no=001 1 row deleted. REG_NO 2 3 4 NAME DEP rohit ECE 1 1 SEM 1 MARK_1 60 70 80 MARK_2 70 80 90 TOT 230 150 170 65 75 85 AVG

thomas EEE sunitha CSE

SQL>select *from book; ISBN 222 454 369 BOOK_NAME julius ceaser paradise lost wings of fire REG_NO 2 3 4

RESULT: Thus the Basic SQL commands has been verified and executed successfully.

INSERT,SELECT,UPDATE AND DELETE COMMANDS


AIM To execute and verify the Special SQL commands. PROCEDURE STEP 1: Start STEP 2: Create the table with its essential attributes. STEP 3: Insert attribute values into the table. STEP 4: Create the view from the above created table. STEP 5: Execute different Commands. STEP 6: Stop

CREATING A TABLE: SQL>create table student(reg_no number(2),name varchar(6),dept number(1),mark_1_number(3),mark_2 number(3),tot number(3),avg number(3)); Table created varchar(3),sem

INSERTING VALUES INTO THE TABLE: SQL>insert into student values(001,harish,IT,50,60,110,55); 1 row created. SQL>insert into student values(002,rohit,ECE,1,60,70,230,65); 1 row created. SQL>insert into student values(003,thomas,EEE,1,70,80,150,75); 1 row created. SQL>insert into student values(004,sunitha,CSC,1,80,90,170,85); 1 row created. SQL>select *from student; REG_NO 1 2 3 4 NAME DEP harish rohit IT ECE 1 1 SEM 1 1 MARK_1 50 60 70 80 90 MARK_2 60 70 80 TOT 110 230 150 170 65 75 85 AVG 55

thomas EEE sunitha CSE

UPDATE THE TABLE: SQL>update student set avg=2+tot/2; 4 rows updated. SQL>select *from student REG_NO 1 2 3 4 NAME DEP harish rohit IT ECE 1 1 SEM 1 1 MARK_1 50 60 70 80 MARK_2 60 70 80 90 TOT 110 230 150 170 65 75 85 AVG 55

thomas EEE sunitha CSE

DELETE THE TABLE: SQL>delete from student where avg<70 2 rows deleted.

REG_NO 3 4

NAME DEP thomas EEE sunitha CSE

SEM 1 1

MARK_1 70 80

MARK_2 80 90

TOT 150 170

AVG 75

85

RESULT: Thus the Special SQL commands has been verified and executed successfully.

EXPT NO:

DATE:

NESTED QUERIES AND JOIN QUERIES

AIM To execute and verify the SQL commands using nested queries and Join queries. PROCEDURE STEP 1: Start STEP 2: Create the table with its essential attributes. STEP 3: Insert attribute values into the table STEP 4: Execute different Commands and extract information from the table. STEP 5: Stop

CREATING A TABLE: SQL>create table student(reg_no number(2),name varchar(6),dept number(1),mark_1_number(3),mark_2 number(3),tot number(3),avg number(3)); Table created varchar(3),sem

INSERTING VALUES INTO THE TABLE: SQL>insert into student values(001,harish,IT,50,60,110,55); 1 row created. SQL>insert into student values(002,rohit,ECE,1,60,70,230,65); 1 row created. SQL>insert into student values(003,thomas,EEE,1,70,80,150,75); 1 row created. SQL>insert into student values(004, sunitha ,CSC,1,80,90,170,85); 1 row created. SQL>select *from student; SQL>alter table student add primary key(reg_no); Table altered. SQL>create table book(reg_no varchar(20),price number(5)); Table created. SQL>insert into book values(1,775,discover of India,001); 1 row created. SQL> insert into book values(2,222,julius ceaser,002); 1 row created. SQL> insert into book values(3,454,paradise lost,003); 1 row created. SQL> insert into book values(4,369,wings of fire,004); 1 row created. number(5),isbn number(5),book_name varchar(20),author_name

OUTPUT:

SQL>select *from student; REG_NO 1 2 3 4 NAME DEP harish rohit IT ECE 1 1 80 SEM 1 1 MARK_1 50 60 70 90 MARK_2 60 70 80 TOT 110 230 150 170 65 75 85 AVG 55

thomas EEE sunitha CSE

SQL>select *from book; REG_NO 1 2 3 4 ISBN BOOK_NAME 775 222 454 369 discovery of India julius ceaser paradise lost wings of life AUTHOR_NAME Nehru shakespear jhon Milton abdul kalam PRICE 150 175 200 250

SQL>select *from student,book where student.reg_no=book.reg_no; REG_NO REG_NO 1 1 2 2 3 3 4 4 NAME DEP SEM MARK_1 MARK_2 TOT PRICE 110 150 70 shakespear 70 jhon Milton 1 80 abdul kalam 90 250 80 230 175 150 200 170 85 75 65 55 AVG

ISBN BOOK_NAME harish 775 rohit 222 IT 1 50

AUTHOR_NAME 60 Nehru 60

discovery of India ECE 1

julius ceaser 1

thomas EEE 454 sunitha 369

paradise lost CSE wings of life

SQL>select *from student,book where student.name(+)=book.book_name;

REG_NO REG_NO

NAME DEP

SEM

MARK_1

MARK_2

TOT PRICE

AVG

ISBN BOOK_NAME

AUTHOR_NAME

1 3 REG_NO REG_NO

775 454

discovery of India paradise lost SEM

Nehru jhon Milton MARK_1 MARK_2

150 200 TOT PRICE AVG

NAME DEP

ISBN BOOK_NAME

AUTHOR_NAME

2 4

222 369

julius ceaser wings of life

shakespear abdul kalam

175 250

SQL>select *from student,book where student.name(+)=book.book_name;

REG_NO REG_NO 1 3 REG_NO REG_NO

NAME DEP

SEM

MARK_1

MARK_2

TOT PRICE 110 150 TOT PRICE

AVG

ISBN BOOK_NAME harish IT 1 1 SEM 50 70

AUTHOR_NAME 60 80 MARK_2

55 75 AVG

thomas EEE NAME DEP

MARK_1

ISBN BOOK_NAME

AUTHOR_NAME

2 4

rohit sunitha

ECE CSE

1 1

60 80

70 90

230 170

65 85

SQL>select b.name,a.name from student a,student b where a.tot=b.tot; Name Harish Thomas Sunitha Rohit Name Harish Thomas Sunitha Rohit

RESULT: Thus the SQL commands has been verified and executed successfully.

SQL COMMANDS FOR VIEWS

AIM To execute and verify the SQL commands for Views. PROCEDURE STEP 1: Start STEP 2: Create the table with its essential attributes. STEP 3: Insert attribute values into the table. STEP 4: Create the view from the above created table. STEP 5: Execute different Commands and extract information from the View. STEP 6: Stop

COMMANDS EXECUTION

CREATION OF TABLE ------------------------------

SQL> create table employee ( Employee_name varchar2(10),employee_nonumber(8), dept_name varchar2(10),dept_no number (5),date_of_join date);

Table created.

TABLE DESCRIPTION -------------------------------

SQL> desc employee; Name Null? Type

------------------------------- -------- -----------------------EMPLOYEE_NAME EMPLOYEE_NO DEPT_NAME DEPT_NO DATE_OF_JOIN VARCHAR2(10) NUMBER(8) VARCHAR2(10) NUMBER(5) DATE

CREATION OF VIEW ------------------------------

SQL> create view empview as select employee_name,employee_no,dept_name,dept_no,date_of_join from employee;

View created.

DESCRIPTION OF VIEW -----------------------------SQL> desc empview;

Name

Null?

Type

----------------------------------------- -------- ---------------------------EMPLOYEE_NAME EMPLOYEE_NO DEPT_NAME DEPT_NO SQL> select * from empview; VARCHAR2(10) NUMBER(8) VARCHAR2(10) NUMBER(5)

EMPLOYEE_N EMPLOYEE_NO DEPT_NAME ---------- ----------- ---------- ---------Ravi Vijay Raj sunitha 124 ECE 345 CSE 98 IT 89 21 22 67

DEPT_NO

100 CSE

MODIFICATION ---------------------SQL> insert into empview values ('Sri',120,'CSE',67,'16-nov-1981'); 1 row created. SQL> select * from empview; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME ---------- ----------- ---------- ---------Ravi Vijay Raj sunitha Sri 124 ECE 345 CSE 98 IT 100 CSE 120 CSE 89 21 22 67 67 DEPT_NO

SQL> select * from employee; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME ---------- ----------- ---------- ---------- --------Ravi Vijay Raj sunitha Sri 124 ECE 345 CSE 98 IT 100 CSE 120 CSE 89 15-JUN-05 21 21-JUN-06 22 30-SEP-06 67 14-NOV-81 67 16-NOV-81 DEPT_NO DATE_OF_J

SQL> delete from empview where employee_name='Sri'; 1 row deleted. SQL> select * from empview; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME ---------- ----------- ---------- ---------Ravi Vijay Raj Sunitha 124 ECE 345 CSE 98 IT 89 21 22 67 DEPT_NO

100 CSE

SQL> update empaviview set employee_name='kavi' where employee_name='ravi'; 0 rows updated. SQL> update empkaviview set employee_name='kavi' where employee_name='Ravi'; 1 row updated. SQL> select * from empkaviview; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME ---------- ----------- ---------- ---------kavi Vijay Raj Sunitha 124 ECE 345 CSE 98 IT 89 21 22 67 DEPT_NO

100 CSE

SQL>drop view empview; View droped

RESULT: Thus the SQL commands for View has been verified and executed successfully.

CURSOR

AIM To write a Cursor Procedure to calculate Payroll process of an Employee. PROCEDURE STEP 1: Start STEP 2: Initialize the Cursor Procedure based on the table attributes to which the actual operation has to be carried out. STEP 3: Develop the procedure with the essential operational parameters. STEP 4: Specify the Individual operation to be each attribute. STEP 5: Execute the Cursor procedure. STEP 6: Stop

EXECUTION

SQL> create table salary(emp_no number(4) primary key,emp_name varchar2(30),designation varchar2(25),department varchar2(30),basic number(5),da_percent number(6,2),other_allowances number(6,2),deduction number(6,2)); number(6,2), ma

Table created. SQL> insert into Sal values (1,'vijay','manager','Accounts',6000,45,200,250,1500.75); 1 row created. SQL> insert into sal values (2,'vasanth','Asst.manager','Accounts',4000,45,200,200,1200); 1 row created. SQL> insert into Sal values(3,' sunitha 1 row created. SQL> select * from sal; Emp_no Emp_name Designation Deduction Department Basic da_percent MA other_allowance ','Steno','sales',2000,45,100,50,200);

1 2 3

vijay

manager

Accounts

6000

45 45 45

200 200 100

250 200 50

1500.75 1200 200

vasanth AsstmanagerAccounts 4000 sunitha Steno sales 2000

SQL> declare e_no number(6); e_name varchar2(25); net_salary number(8,2); cursor cur_salary is select emp_no, emp_name,basic+da_percent*basic/100+ma+other_allowance-deduction from sal; begin dbms_output.put_line('emp no '||' Name '||' Net salary'); dbms_output.put_line('--------------------'); open cur_salary; loop fetch cur_salary into e_no,e_name,net_salary;

exit when cur_salary%notfound; dbms_output.put_line(rpad(e_no,10,' ')||rpad(e_name,25,' ')||net_salary); end loop; close cur_salary; end; OUTPUT:

emp no
1 2 3

Name
vijay vasanth sunitha

Net salary
7649.25 5000 2850

PL/SQL procedure successfully completed.

RESULT: Thus the Cursor Procedure for calculating the Payroll process has been executed successfully.

PROCEDURES

AIM

To write a PL/SQL block to display the student name, marks whose average mark is above 60%.

ALGORITHM

STEP1:Start

STEP2:Create a table with table name stud_exam

STEP3:Insert the values into the table and Calculate total and average of each student

STEP4: Execute the procedure function the student who get above 60%.

STEP5: Display the total and average of student

STEP6: End

CREATE A TABLE: SQL>create table dept 2( 3 deptno number(3) 4 dname varchar2(10) 5 loc varchar2(10)); Table created. CREATE PROCEDURE: SQL>create or replace procedure inpro(dno number,depname varchar2,city varchar2) 2 as

3 begin 4 insert into dept(deptno,dname,loc)values(dno,depname,city); 5 end; 6/ Procedure created. SQL>select *from dept; No rows selected; SQL>exec inpro(32,computer ,salem); PL/SQL procedure successfully completed. SQL>select *from dept; DEPTNO 32 DNAME computer LOC salem

RESULT:Thus the PL/SQL block to display the student dept,name,loc is verified and executed.

FUNCTIONS

AIM To write a Functional procedure to search an address from the given database. PROCEDURE STEP 1: Start STEP 2: Create the table with essential attributes. STEP 3: Initialize the Function to carryout the searching procedure.. STEP 4: Frame the searching procedure for both positive and negative searching. STEP 5: Execute the Function for both positive and negative result . STEP 6: Stop

CREATE A FUNCTION SQL>create or replace function fact(n number) return number 2 as 3 fac number:=1; 4 begin 5 for I in 1..n 6 loop 7 fac:=fac*I; 8 end loop; 9 return fac; 10 end; 11 / Function created. SQL>select fact(4) from dual; Fact(4) 24 SQL>create or replace function cub(n number)return number 2 as 3 c number; 4 begin 5 C:=n*n*n; 6 return c; 7 end; 8/ Function created SQL>select cub(4) from dual;

CUB(4) 64

RESULT:Thus the Function for searching process has been executed successfully.

CONTROLS

AIM To write a PL/SQL block using different control (if else, for loop, while loop,) statements. PROCEDURE STEP 1: Start STEP 2: Initialize the necessary parameters. STEP 3: Develop the set of statements with the essential operational parameters. STEP 4: Specify the Individual operation to be carried out. STEP 5: Execute the statements. STEP 6: Stop.

********************ADDITION OF TWO NUMBERS***********************

SQL> declare a number; b number; c number; begin a:=&a; b:=&b; c:=a+b; dbms_output.put_line('sum of'||a||'and'||b||'is'||c); end; / INPUT:

Enter value for a: 23 old 6: a:=&a; new 6: a:=23; Enter value for b: 12 old 7: b:=&b; new 7: b:=12;

OUTPUT: sum of23and12is35

PL/SQL procedure successfully completed.

*********** GREATEST OF THREE NUMBERS USING IF ELSE*************

SQL> declare a number; b number; c number; d number; begin a:=&a; b:=&b; c:=&b; if(a>b)and(a>c) then dbms_output.put_line('A is maximum'); elsif(b>a)and(b>c)then dbms_output.put_line('B is maximum'); else dbms_output.put_line('C is maximum'); end if; end; /

INPUT:

Enter value for a: 21 old 7: a:=&a; new 7: a:=21; Enter value for b: 12 old 8: b:=&b; new 8: b:=12; Enter value for b: 45 old 9: c:=&b; new 9: c:=45;

OUTPUT:

C is maximum PL/SQL procedure successfully completed.

RESULT:Thus the PL/SQL block for different controls are verified and executed.

TRIGGER

AIM To develop and execute a Trigger for Before and After update, delete, insert operations on a table. PROCEDURE STEP 1: Start STEP 2: Initialize the trigger with specific table id. STEP 3:Specify the operations (update, delete, insert) for which the trigger has to be executed. STEP 4: Execute the Trigger procedure for both Before and After sequences STEP 5: Carryout the operation on the table to check for Trigger execution. STEP 6: Stop

EXECUTION

SQL> create table empa(id number(3),name varchar2(10),income number(4),expence number(3),savings number(3)); Table created. SQL> insert into empa values(2,'kumar',2500,150,650); 1 row created. SQL> insert into empa values(3,'venky',5000,900,950); 1 row created. SQL> insert into empa values(4,'anish',9999,999,999); 1 row created. SQL> select * from empa; ID NAME INCOME EXPENCE SAVINGS

---------- ---------- ---------- ---------- --------------------------------------2 3 4 kumar venky anish 2500 5000 9999 150 900 999 650 950 999

TYPE 1- TRIGGER AFTER UPDATE SQL> create or replace trigger vijay after update or insert or delete on emp for each row begin if updating then dbms_output.put_line('table is updated'); elsif inserting then dbms_output.put_line('table is inserted'); elsif deleting then dbms_output.put_line('table is deleted'); end if; end; / Trigger created.

SQL> update emp set income =900 where empname='kumar'; TABLE IS UPDATED

1 row updated. SQL> insert into emp values ( 4,'Chandru',700,250,80); TABLE IS INSERTED 1 row created. SQL> DELETE FROM EMP WHERE EMPID = 4; TABLE IS DELETED 1 row deleted. SQL> select * from emp; EMPID EMPNAME --------- --------------2 3 9 TYPE 2 sunitha kumar vasanth INCOME EXPENSE SAVINGS ------------ ------------- ------------830 5000 987 150 550 6554 100 50 644

- TRIGGER BEFORE UPDATE

SQL> create or replace trigger vasanth before update or insert or delete on employee for each row begin if updating then dbms_output.put_line('table is updated');

elsif inserting then dbms_output.put_line('table is inserted'); elsif deleting then dbms_output.put_line('table is deleted'); end if; end; / Trigger created.

SQL> INSERT INTO EMP VALUES (4,'SANKAR',700,98,564); TABLE IS INSERTED

1 row created.

SQL> UPDATE EMP SET EMPID = 5 WHERE EMPNAME = 'SANKAR'; TABLE IS UPDATED 1 row updated.

SQL> DELETE EMP WHERE EMPNAME='SANKAR'; TABLE IS DELETED 1 row deleted.

RESULT: Thus the Trigger procedure has been executed successfully for both before and after sequences.

FRONT END TOOLS

AIM To design a form using different tools in Visual Basic.

PROCEDURE STEP 1: Start STEP 2: Create the form with essential controls in tool box. STEP 3: Write the code for doing the appropriate functions. STEP 4: Save the forms and project. STEP 5: Execute the form . STEP 6: Stop

EXECUTION

Form1

Private Sub Command1_Click()

List1.AddItem Text1.Text List1.AddItem Text2.Text If Option1.Value = True Then gender = "male" End If If Option2.Value = True Then gender = "female" End If List1.AddItem gender List1.AddItem Text3.Text If Check1.Value = 1 And Check2.Value = 0 Then area = "software Engineering" End If If Check1.Value = 1 And Check2.Value = 1 Then area = "software Engineering & Networks" End If If Check1.Value = 0 And Check2.Value = 1 Then area = " Networks" End If List1.AddItem area List1.AddItem Text4.Text End Sub

Private Sub Command2_Click() If List1.ListIndex <> 0 Then

List1.RemoveItem (0) End If End Sub

Private Sub Command3_Click() End End Sub

Sample Snapshot:

RESULT: Thus the program has been loaded and executed successfully.

FORM DESIGN

AIM To design a form using Visual Basic.

PROCEDURE STEP 1: Start STEP 2: Create the form with essential controls in tool box. STEP 3: Write the code for doing the appropriate functions. STEP 4: Save the forms and project. STEP 5: Execute the form. STEP 6: Stop

EXECUTION

Form1

Private Sub Command1_Click() Dim a As Integer a = Val(Text1.Text) + Val(Text2.Text) MsgBox ("Addition of Two numbers is" + Str(a)) End Sub

Private Sub Command2_Click() Dim b As Integer b = Val(Text1.Text) - Val(Text2.Text) MsgBox ("Subraction of Two numbers is" + Str(b)) End Sub

Private Sub Command3_Click() Dim c As Integer c = Val(Text1.Text) * Val(Text2.Text) MsgBox ("Multiplication of Two numbers is" + Str(c)) End Sub

Private Sub Command4_Click() Dim d As Integer d = Val(Text1.Text) / Val(Text2.Text) MsgBox ("Division of Two numbers is" + Str(d)) End Sub Private Sub Command5_Click() End End Sub

Sample Snapshot:

RESULT: Thus the program has been loaded and executed successfully.

MENU DESIGN

AIM To design a menu using Visual Basic.

PROCEDURE STEP 1: Start STEP 2: Create the form with essential controls and insert the menu using menu editor. STEP 3: Write the code for doing the appropriate functions. STEP 4: Save the forms and project. STEP 5: Execute the form. STEP 6: Stop

EXECUTION

Form 1:

Private Sub mapple_Click() MsgBox ("You selected Apple") End Sub

Private Sub mblue_Click() MsgBox ("You selected Blue color") End Sub

Private Sub mcircle_Click() MsgBox ("You selected Circle") End Sub

Private Sub mexit_Click() End End Sub

Private Sub mgrapes_Click() MsgBox ("You selected Grapes") End Sub

Private Sub mgreen_Click() MsgBox ("You selected Green color ") End Sub

Private Sub morange_Click() MsgBox ("You selected Orange") End Sub

Private Sub mrectangle_Click() MsgBox ("You selected Rectangle") End Sub

Private Sub mred_Click() MsgBox ("You selected Red color") End Sub

Private Sub mtriangle_Click() MsgBox ("You selected Triangle") End Sub Sample Snapshot:

RESULT: Thus the program for menu creation with menu editor has been developeded and executed successfully.

REPORT GENERATION

AIM To design a report for employee database using Visual Basic.

PROCEDURE STEP 1: Start STEP 2: Create the form with essential controls for employee details. STEP 3: Insert the data environment for report generation STEP 4: Connect the database STEP 5: Write the code for doing the appropriate operations in the employee database. STEP 6: Save the forms and project. STEP 7: Execute the form. STEP 8: Stop

EXECUTION

MAIN FORM CODE: Private Sub Command1_Click() Unload Me Form1.Visible = False Form2.Visible = True

Load Form2 Form2.Show End Sub

Private Sub Command2_Click() Unload Me Form1.Visible = False Form3.Visible = True Load Form4 Form3.Show End Sub

Private Sub Command3_Click() Unload Me Form1.Visible = False Form4.Visible = True Load Form3 Form4.Show End Sub Private Sub Command4_Click() End End Sub

Private Sub Command5_Click() DataReport1.Show

End Sub

FORM2 CREATION CODE:

General Declaration Dim con As New ADODB.Connection Dim gp, ded, net As Double

Private Sub Command1_Click() gp = Val(Combo1.ItemData(Combo1.ListIndex)) + Val(Text7.Text) ded = Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) net = gp - ded con.Execute "insert into emp values('" & Text1.Text & "','" & Text2.Text & "','" & Combo1.Text & "','" & Text3.Text & "','" & Val(Combo1.ItemData(Combo1.ListIndex)) & "','" & Val(Text4.Text) & "','" & Val(Text5.Text) & "','" & Val(Text6.Text) & "','" & Val(Text7.Text) & "','" & gp & "','" & net & "',0)" MsgBox ("Records Created!!!!!!!!!!!") Unload Form2 Load Form1 Form1.Show End Sub

Private Sub Form_Load() con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Studio\VB98\subbu\employee.mdb;Persist Security Info=False" End Sub Files\Microsoft Visual

Private Sub Form_Unload(Cancel As Integer) con.Close End Sub

FORM3 UPDATION CODE:

General Declaration

Dim con As New ADODB.Connection Dim rs As New ADODB.Recordset

Dim n As Double

Private Sub Command1_Click() rs.Open "select * from emp where id='" & Text1.Text & "'", con n = rs.Fields(10) + Val(Text2.Text) con.Execute "update emp set others='" & Val(Text2.Text) & "',net_salary='" & n & "' where id='" & Text1.Text & "'" MsgBox ("Records Updated!!!!!!!!!!!!!") Unload Form3 Load Form1 Form1.Show End Sub

Private Sub Form_Load() con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Studio\VB98\subbu\employee.mdb;Persist Security Info=False" End Sub Files\Microsoft Visual

Private Sub Form_Unload(Cancel As Integer) con.Close End Sub

FORM4 DISPLAY CODE: General Declaration Dim con As New ADODB.Connection Dim rs As New ADODB.Recordset Dim num As String

Private Sub Command1_Click() num = Text1.Text

rs.Open "select * from emp where id='" + num + "'", con Set DataReport1.DataSource = rs DataReport1.Show End Sub

Private Sub Form_Load() con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Studio\VB98\subbu\employee.mdb;Persist Security Info=False" End Sub Files\Microsoft Visual

Private Sub Form_Unload(Cancel As Integer) con.Close End Sub

DATABASE: EMPLOYEE DETAILS


EMPLOY INFORMATION

EMPLOYEE CREATE FORM DETAILS

DATABASE RECORDS:

UPDATE EMPLOYEE DETAILS:

UPDATED DATABASE:

DISPLAY:

DATA REPORT:

RESULT: Thus the program has verified and executed successfully.

PAYROLL PROCESSING SYSTEM


AIM To develop an application software for Payroll processing of an organization . DESIGN PLAN The Design plan consists of the following: Project Plan Software requirement Analysis Implementation and Coding Software testing Software Debugging Conclusion PROJECT PLAN The Project plan consists of three sections:

Personal Details of an employee Allowances Deduction and Checking the increement and Net pay

SOFTWARE REQUIREMENT ANALYSIS

The purpose of the Payroll as to provide Payroll for the Employee with allowance and deduction individually and to update the Net pay.

Functionality of System:

1. Personal Details of an Employee: It includes Employee Name ,Employee id,Address,Designation and Date of Birth. 2. Allowance: DA refers to Dearness Allowance,TA refers to Travelling Allowance, HRA refers to House Rent Allowance, MA refers to Medical Allowance. 3. Deduction: PF refers to Provident Fund. LIC refers to Life Insurance Corporation, Vehicle Loan

SOFTWARE TESTING The main objectives of testing to maximize the test case , minimize the number of errors, focus on correctness and efficiency of program.It helps to find out details of the employee and their personal details, experience with total salary. Allowances and Deductions are calculated from GROSS amount. EXECUTION

FORM 1: Private Sub Command1_Click() Unload Me Form2.Show End Sub

Private Sub Command2_Click() Unload Me Form3.Show End Sub Private Sub Command3_Click() Unload Me

Form4.Show End Sub

Private Sub Command4_Click() End End Sub

Private Sub Command5_Click() Unload Me Form5.Show End Sub

FORM 2: Private Sub Command1_Click() Adodc1.Recordset.AddNew Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Fields("e_no") = Val(Text2.Text) Adodc1.Recordset.Fields("des") = Text3.Text Adodc1.Recordset.Fields("age") = Val(Text4.Text) Adodc1.Recordset.Fields("sex") = Text5.Text Adodc1.Recordset.Fields("dob") = Val(Text6.Text) Adodc1.Recordset.Fields("doj") = Val(Text7.Text) Adodc1.Recordset.Fields("sal") = Val(Text8.Text) Adodc1.Recordset.Fields("ph") = Val(Text9.Text) Adodc1.Recordset.Fields("e_mail") = Text10.Text 'Adodc1.Recordset.Update End Sub

Private Sub Command2_Click() Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Update End Sub

Private Sub Command3_Click() a = InputBox("Enter the Employee Number", Emp_no) Adodc1.Recordset.MoveFirst On Error GoTo diva While Not Adodc1.Recordset.Fields("e_no") = Val(a) Adodc1.Recordset.MoveNext Wend End Sub

Private Sub Command4_Click() b = MsgBox("Are you sure you want to delete it....", vbOKCancel + vbExclamation) If b = 1 Then Adodc1.Recordset.Delete Adodc1.Recordset.MoveNext MsgBox "Record is Deleted" Else End If End Sub

Private Sub Command5_Click() Unload Me Load Form1: Form1.Visible = True End Sub

FORM 3: Dim c As Variant Private Sub Command1_Click() Adodc1.Recordset.AddNew Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Fields("e_no") = Val(Text2.Text) Adodc1.Recordset.Fields("sal") = Val(Text3.Text) Adodc1.Recordset.Fields("loan") = Val(Text4.Text) Adodc1.Recordset.Fields("loan_left") = Val(Text5.Text) Adodc1.Recordset.Fields("ma") = Val(Text6.Text) Adodc1.Recordset.Fields("hra") = Val(Text7.Text) Adodc1.Recordset.Fields("ins_left") = Val(Text8.Text) Adodc1.Recordset.Fields("da") = Val(Text9.Text) Adodc1.Recordset.Fields("total_allow") = Val(Text10.Text) 'adodc1.Recordset.Update End Sub

Private Sub Command2_Click() Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Update End Sub Private Sub Command3_Click() a = InputBox("Enter the Employee Number", "Diva") Adodc1.Recordset.MoveFirst On Error GoTo diva While Not Adodc1.Recordset.Fields("e_no") = Val(a) Adodc1.Recordset.MoveNext Wend diva: End Sub

Private Sub Command4_Click() b = MsgBox("Are you sure you want to delete it....", vbOKCancel + vbCritical, "Diva") If b = 1 Then Adodc1.Recordset.Delete Adodc1.Recordset.MoveNext MsgBox "Record is Deleted" Else End If End Sub Private Sub Command5_Click() Unload Me Load Form1: Form1.Visible = True End Sub Private Sub Form_Load() c = (Val(Text6.Text) + Val(Text7.Text) + Val(Text9.Text)) Text10.Text = c Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Update End Sub Private Sub Text3_Change() x = Val(Text3.Text) Text6.Text = (x / 2) Text7.Text = (x / 3) Text9.Text = (x / 4) c = (Val(Text6.Text) + Val(Text7.Text) + Val(Text9.Text)) Text10.Text = c Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Update End Sub

FORM 4: Dim c As Variant Private Sub Command1_Click() Adodc1.Recordset.AddNew Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Fields("e_no") = Val(Text2.Text) Adodc1.Recordset.Fields("sal") = Val(Text3.Text) Adodc1.Recordset.Fields("spf") = Val(Text4.Text) Adodc1.Recordset.Fields("fa") = Val(Text5.Text) Adodc1.Recordset.Fields("hf") = Val(Text6.Text) Adodc1.Recordset.Fields("hr") = Val(Text7.Text) Adodc1.Recordset.Fields("income_tax") = Val(Text8.Text) Adodc1.Recordset.Fields("others") = Val(Text9.Text) Adodc1.Recordset.Fields("total_ded") = Val(Text10.Text) 'adodc1.Recordset.Update End Sub Private Sub Command2_Click() Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Update End Sub Private Sub Command3_Click() a = InputBox("Enter the Employee Number", "Diva") Adodc1.Recordset.MoveFirst On Error GoTo diva While Not Adodc1.Recordset.Fields("e_no") = Val(a) Adodc1.Recordset.MoveNext Wend diva: End Sub

Private Sub Command4_Click() b = MsgBox("Are you sure you want to delete it....", vbOKCancel + vbCritical, "Diva") If b = 1 Then Adodc1.Recordset.Delete Adodc1.Recordset.MoveNext MsgBox "Deleted" Else End If End Sub Private Sub Command5_Click() Unload Me Load Form1: Form1.Visible = True End Sub Private Sub Form_Load() x = Val(Text3.Text) Text4.Text = (x / 0.2) Text5.Text = (x / 0.2) Text6.Text = (x / 0.2) Text7.Text = (x / 0.2) Text8.Text = (x / 0.2) Text9.Text = (x / 0.2) c = (Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text) + Val(Text8.Text) + Val(Text9.Text)) Text10.Text = c Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Update End Sub

Private Sub Text2_Change() c = (Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text) + Val(Text8.Text) + Val(Text9.Text)) Text10.Text = c End Sub

Private Sub Text3_Change() x = Val(Text3.Text) Text4.Text = (x / 0.2) Text5.Text = (x / 0.2) Text6.Text = (x / 0.2) Text7.Text = (x / 0.2) Text8.Text = (x / 0.2) Text9.Text = (x / 0.2) Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Update End Sub

FORM 5: Private Sub Command1_Click() Unload Me Load Form1: Form1.Visible = True End Sub

Private Sub Command2_Click() End End Sub

Private Sub Command3_Click() a = InputBox("Enter the Employee Number", "Diva") Adodc1.Recordset.MoveFirst On Error GoTo diva While Not Adodc1.Recordset.Fields("e_no") = Val(a) Adodc1.Recordset.MoveNext Wend diva: End Sub

Private Sub Form_Load() Adodc1.Recordset.Fields("e_name") = Text1.Text Adodc1.Recordset.Update End Sub

Private Sub Text1_Change() b = Val(Text3.Text) + Val(Text4.Text) c = b - Val(Text5.Text) Text6.Text = c End Sub

CONCLUSION

The PayRoll Software can be used in Corporate offices, Organizations and Institutes for calculating the net pay feasibly. The software is user-friendly and can be handled by anyone.

BANKING SYSTEM
AIM To develop an application software for Automating Banking System.

PROCEDURE STEP 1: Start STEP 2: Create the form with essential controls for bank details. STEP 3: Insert the data environment for banking systems STEP 4: Connect the database STEP 5: Write the code for doing the appropriate operations in the bank database. STEP 6: Save the forms and project. STEP 7: Execute the form. STEP 8: Stop

EXECUTION FORM 1:

Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Private Sub Command1_Click() rs.AddNew txtClear Text1.SetFocus End Sub Private Sub Command2_Click() rs(0).Value = Text1.Text rs(1).Value = Val(Text2.Text) rs(2).Value = Text3.Text rs(3).Value = Val(Text4.Text) rs.Update MsgBox "Record Updated" End Sub Private Sub Command3_Click() On Error Resume Next If rs.EOF Then MsgBox "No Records" Else rs.Delete rs.MoveNext display MsgBox "Record Deleted" End If End Sub

Private Sub Command4_Click() rs.MoveFirst display End Sub Private Sub Command5_Click() rs.MoveNext If Not rs.EOF Then display Else MsgBox "End of the Record" End If rs.MovePrevious End Sub Private Sub Command6_Click() Form2.Show End Sub Private Sub Command7_Click() End End Sub Private Sub Command8_Click() Form3.Show End Sub Private Sub Form_Load() cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\BANK.MDB;Persist Security Info=False" cn.CursorLocation = adUseClient rs.Open "select * from Bank", cn, adOpenKeyset, adLockOptimistic End Sub

Sub txtClear() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" End Sub Sub display() Text1.Text = rs(0).Value Text2.Text = rs(1).Value Text3.Text = rs(2).Value Text4.Text = rs(3).Value End Sub FORM 2: Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Private Sub Command1_Click() Dim AccNo As Integer AccNo = Val(Text1.Text) rs.MoveFirst Do While Not rs.EOF If rs(1).Value = AccNo Then rs(3).Value = rs(3).Value + Val(Text2.Text) rs.Update MsgBox "Amount Deposited" End If rs.MoveNext Loop End Sub

Private Sub Command2_Click() Dim AccNo As Integer, Bal As Double AccNo = Val(Text1.Text) Bal = Val(Text2.Text) rs.MoveFirst Do While Not rs.EOF If rs(1).Value = AccNo Then If Bal >= 500 Then rs(3).Value = rs(3).Value - Val(Text2.Text) rs.Update MsgBox "Amount withdrawn" Else MsgBox "Insufficient Balance" End If End If rs.MoveNext Loop End Sub

Private Sub Form_Load() cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\BANK.MDB;Persist Security Info=False" cn.CursorLocation = adUseClient rs.Open "select * from Bank", cn, adOpenKeyset, adLockOptimistic End Sub

Conclusion Thus the Software provides efficient way for Banking System, It provides way for depositing and withdrawing the amount.

S-ar putea să vă placă și