DBMS Record
DBMS Record
NAME.. REG.NO
COURSE
SEMESTER:
This is certified to be the bonafide record of work done by the student in the Data base management system lab (CS1307) of Indira Institute of Engineering Technology in the department of information technology during the year. Nov- 2009
Staff-In-Charge
Internal Examiner
External Examiner
INDEX
EXP.NO
1 (DDL) command in RDMS Data manipulation language and 2 3 4 5 6 7 Normalization Design and implementation of 8 Library Information System Design and implementation of 9 Banking System Design and implementation of Pay 10 roll processing triggers Procedure and function Embedded SQL Data base design using DCL command in RDMS High level language extension High level language extension with
DATE
PROGRAM
Data definition language
PAGE NO
SIGNATURE
CREATING TABLES
STUDENT TABLE SQL> create table student(sno number(8)primary key, sname varchar2(20),fathername varchar2(20),dept varchar2(16),sex char(7),feesdue number(7,2),DOB date);
EXAM TABLE SQL> create table exam(sno number(8)primary key, sem number(3),noofpapers number(2),exmfees number(7,2));
MARK TABLE SQL>create table mark(sno number(8)primary key, sem number(3),sub1 number(3),sub2 number(3),sub3 number(3), total number(4),avg number(5,2),status char(4),grade char(4));
Name SNO SEM SUB1 SUB2 SUB3 TOTAL AVG STATUS GRADE ALTERING TABLE
Type NUMBER(8) NUMBER(3) NUMBER(3) NUMBER(3) NUMBER(3) NUMBER(4) NUMBER(5,2) CHAR(4) CHAR(4)
SQL>alter table mark modify(total number(5),status char(6)); Name SNO SEM SUB1 SUB2 SUB3 TOTAL AVG STATUS GRADE Null? NOT NULL Type NUMBER(8) NUMBER(3) NUMBER(3) NUMBER(3) NUMBER(3) NUMBER(5) NUMBER(5,2) CHAR(6) CHAR(4)
DATA MANIPULATION LANGUAGE (DML) and DATA CONTROL LANGUAGE (DCL) commands in RDBMS
AIM: To implement the DML and DCL commands in RDBMS. DML commands: 1.Command: SELECT Syntax: SELECT[ALL | DISTINCT] select list FROM table_name1[,table_nameN] [JOIN join_condition] [WHERE search_condition] Example Query: SELECT * FROM STUDENT WHERE ROLLNO=1; 2.Command: INSERT Syntax: INSERT INTO[[database_name]owner]{table_name|view_name} [(column_list)]{[DEFAULT]VALUES|VALUES(value[])|SELECT Statement} Example Query: INSERT INTO STUDENT VALUES(03,Ramki,2-JUN-1988, 5,Lakshmi nagar,Chennai-24,87.5); 3.Command: UPDATE Syntax: UPDATE table_name SET column_name=expression[,n] WHERE search_condition Example Query: UPDATE STUDENT SET PERCENTAGE=90 WHERE ROLLNO=1; 4.Command: DELETE Syntax: DELETE[FROM] table_name WHERE search_condition]
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 2 Example Query: DELETE FROM STUDENT WHERE ROLLNO=5; DCL commands 1.Command: GRANT Syntax: GRANT permissions ON objects TO account Example Query 1: GRANT INSERT ON employee TO PUBLIC; Example Query 2: GRANT SELECT,UPDATE ON employee to username; 2.Command: REVOKE Syntax: REVOKE permissions ON object FROM account Example Query: REVOKE SELECT ON student FROM username; 1. 1. Create a table student with field roll no student name ,dept marks ,Average ,grade and status, DOB address. Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 2 2. Insert the values for the tables. Date:
ROLLNO STUDENTNAME DEPT AVERAGE GRADE STATUS DOB 16B.tech 1 Sudhir 86 Distctn Pass JUNIT 88 26B.tech 2 Sudesh 79.8 Distctn Pass DECIT 87 164 Sudharsan Mech 77.8 Distctn Pass JUN88
3. Select the student detail those who are in IT Department. ROLLNO STUDENTNAME DEPT AVERAGE GRADE STATUS DOB ADRESS 26B.tech 42 1 Sudesh 79.8 Distctn Pass DECIT Thinanur 87
4. Select the Student those who are not belong to Mech Dept. ROLLNO STUDENTNAME DEPT AVERAGE GRADE STATUS DOB ADRESS 26B.tech 42 1 Sudesh 79.8 Distctn Pass DECIT Thinanur 87 253 Thomas Ece 80.8 Distctn Pass 82new JUN-88
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 5. Select Student detailo from obtain grade Distinc in the Examinaation. Date:
ROLLNO STUDENTNAME DEPT AVERAGE GRADE STATUS DOB 16B.tech 1 Sudhir 86 Distctn Pass JUNIT 88 26B.tech 2 Sudesh 79.8 Distctn Pass DECIT 87 164 Sudharsan Mech 77.8 Distctn Pass JUN88
6. Select rollno name,mark detail from the table student. ROLLNO 1 2 3 AVERAGE GRADE 79.8 Distctn 77.8 Distctn 80.8 Distctn STATUS Pass Pass Pass
7. Retrive the name and address of all the studens who are in IT department. ROLLNO 1 AVERAGE GRADE 79.8 Distctn STATUS Pass
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 8. Update the percentage of the student whose roll no is 1. Date:
ROLLNO STUDENTNAME DEPT AVERAGE GRADE STATUS DOB ADRESS 26B.tech 42 1 Sudesh 86 Distctn Pass DECIT Thinanur 87 162 Sudharsan Mech 77.8 Distctn Pass 82Grace JUN-88 253 Thomas Ece 80.8 Distctn Pass 82new JUN-88
9. Updte the address of the student in Mech department. ROLLNO STUDENTNAME DEPT AVERAGE GRADE STATUS DOB 26B.tech 1 Sudesh 86 Distctn Pass DECIT 87 162 Sudharsan Mech 77.8 Distctn Pass JUN88 253 Thomas Ece 80.8 Distctn Pass JUN88 ADRESS 42 Thinanur 3 pattabiram 82new
10. Delete the student details where rollno=3 ROLLNO STUDENTNAME DEPT AVERAGE GRADE STATUS DOB ADRESS 1 Sudesh B.tech IT 86 Distctn Pass 26-DEC-87 42 Thinanur and Dept. 2 Sudharsan Mech 77.8 Distctn Pass 16-JUN-88 3 pattabiram
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 11. create a table employee with empname salary Name EMPNAME SALARY DEPT EMPNAME Sudhir Sudeesh Arjit Bai Null? VARCHAR2(15) NUMBER(15) VARCHAR2(15) SALARY 7500 6700 5500 6900 Manager Manager Supervisor Supervisor DEPT Type Date:
13. List the name of all the employee other than Manager. EMPNAME Arjit Bai
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: Date: 14. find the sum of the salary of all employee of Manager department as well as Max and Minimum salary. MAX(SALARY) 7500 MIN(SALARY) 5500 SUM(SALARY) 114900
15. Find the sum of salary of all Employee of manager Department as well as Max salary and Minimum salary.
MIN(SALARY) 5500
SUM(SALARY) 90100
DELETE FROM STUDENT WHERE ROLLNO=5; DCL commands 1.Command: GRANT Syntax: GRANT permissions ON objects TO account Example Query 1: GRANT INSERT ON employee TO PUBLIC; Example Query 2: GRANT SELECT,UPDATE ON employee to username; 2.Command: REVOKE Syntax: REVOKE permissions ON object FROM account Example Query: REVOKE SELECT ON student FROM username; RESULT: Thus the DML and DCL commands in RDBMS are implemented
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 3 AIM: To study the PL/SAQL programs and to write the PL/SAQL programs using cursors. DEFINIYION AND SYNTAX: 1. PL/SQL: PL/SQL stands for procedural structural language/SQL. PL/SQL extends SQL by adding control structures found in other structural languages. PL/SQL can be used in the Oracle relational database in the Oracle server and in the client side application development tools. SYNTAX: APL/SQL block can divide into three parts namely, i) Declarative part, ii) Executable part, and iii) Exception handling part. The order is shown below: DECLARE Declarations BEGIN Executable statements EXCEPTION Handlers END; Objects can be declared in declarative part, which can be used in executable part for further manipulation. All procedural statements are included between the BEGIN and END statements. Errors that occur during the exception are handled by the exception handlers. 2. ATTRIBUTES: Attributes allows us to refer data types and objects from database. PL/SQL constants and variables have attributes. The following are the types of attributes supported by the PL/SQL, %type %row type Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 3 %type: %type is used when declaring variables that refer to database columns. SYNTAX: Variablename tablename.Column %type; %rowtype: %rowtype attributes provides a record type that rapresents a row in the tablw. The record can store an entire row of data selected from the table or fetched by a cursor. SYNTAX: Variablename tablename %rowtype; 3. CURSORS: Oracle allocates a memory known as the context area for the processing of the SQL statements. A cursor is a pointer or handle to the context area. Through the cursor, a PL/SQL program can control the context area and what happens to it as the statement is processed. The three types of the cursors are Static cursors Dynamic cursors REF cursors Static cursors are the ones whose select statements are known at the compile time. These are further classified into Explicit cursors Implicit cursors Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 3 dif:=a-b; dbms_output.put_line(The Difference is||dif); pro:=a*b; dbms_output.put_line(The Product is||pro); div:=a/b; dbms_output.put_line(The Quotent is||div); end; Date:
OUTPUT:
Enter value for a: 25 Old 9:a:=&a; New 9:a:=25; Enter value for b: 4 Old 10:b:=&b; New 10:b:=4; The Sum is 29 The Difference is 21 The Product is 100 The Quotent is 6.25 PL/SQL procedure successfully completed.
RESULT:
Thus the PL/SQL program using the cursors were executed successfully.
EX NO: 4
ERROR at line 1: ORA-20001: you cannot insert a row ORA-06512: at SCOTT.ins1, line 2 ORA-04088: error during execution of trigger SCOTT.ins1 DELETE: --create or replace trigger del1 before delete on emp --begin --raise_application_error(-20001.you cannot delete a row); --end; OUTPUT: SQL>delete from emp where eid=2387; delete from emp where eid=2387; ERROR at line 1: ORA-20001: you cannot delete a row ORA-06512: at SCOTT.del1, line 2 ORA-04088: error during execution of trigger SCOTT.del1 UPDATE: --create trigger upd1 before update on emp for each row --begin --raise_application_error(-20001.you cannot update a row); --end; OUTPUT: SQL>update emp set salary=5000 where eid=321; update emp set salary=5000 where eid=321; ERROR at line 1: ORA-20001: you cannot update a row ORA-06512: at SCOTT.upd1, line 2 ORA-04088: error during execution of trigger SCOTT.upd1 RESULT: Thus the usage of trigger were studied and executed in RDBMS.
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 5 where arguments can be in, out or inout. Date:
Similar to a procedure, a function also has two parts namely, the function specification and the function body. The function specification begins with the keyword function and ends with the return clause. The function body begins with the keyword is and ends with the keyword end. A PL/SQL block can also be included in a function body. create or replace function factorial(n number) return number is fac number; i number; begin fac:=1; for I in 1n loop fac:=fac*i; end loop; return fac; end; //Function created. declare n number; x number; begin n:=&n; x:=factorial(n); dbms_ouytput.put_line(the factorial of ||n||is||x); end; OUTPUT SQL>/ Enter value for n: 5 Old 5:n:=&n; New 5:n:=5; The factorial of 5 is 120 PL/SQL procedure successfully completed. RESULT: Thus the procedures and functions were studied and executed in PL/SQL.
EMBEDDED SQL
AIM: To write JAVA program to implement embedded SQL. ALGORITHM: 1. Start the program. 2. Create Database using Microsoft Access with the following fields, FIELDS DATATYPE Roll no Name Dept Marks Number Text Text Number
3. Open MS.Access and then select Blank Database. In the File new database dialog give the DBname and save it in C. Then click create button. 4. Select create table in design view option from the dialog box that appears. Add all the fields in the resulting dialog box. 5. Save the table and insert values into it. 6. Next create the DSN by the following steps: a. Select Administrative Tools option from Control Panel. Then click on Data Source(ODBC), which displays a dialog box named ODBC DataSourceAdministrator in which click Add button. b. In Create New Data Source dialog box, select Driver do Microsoft Access (*.mdb) and click finish button. c. Give a suitable Data Source Name and click select button. d. Select the database name that you have created and click OK. e. Make sure that the path name of your database appears and finally click OK. 7. Go to command prompt and type the JAVA program. 8. Compile and run the program.
PROGRAM:
import java.io.*; import java.sql.*; public class jdeg { Public static void main(String args[])throws IOExcepyion { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String rollno,nam,dep,mark; System.out.println(Enter the values(rno,name,dept,marks)to insert into table); rollno=br.readLine(); nam=br.readLine(); dep=br.readLine(); mark=br.readLine(); try { Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); Connection con=DriverManager.getConnection(jdbc:odbc:stu); st.executeUpdate(insert into student values(+rollno+,+nam+, +dep+,+mark+)); ResultSet rs-st.executeQuery(select * from student); System.out.println(); System.out.println(); System.out.println(RNO\tNAME\tDEPT\tMARKS); while(rs.next()) { System.out.println(rs.getString(rno)+\t); System.out.println(rs.getString(name)+\t); System.out.println(rs.getString(dept)+\t); System.out.println(rs.getString(marks)+\t); } } catch(Exception e) { System.out.println(e); } } }
EX NO: 6
OUTPUT:
D:\jdk1.3\bin>edit jdeg.java D:jdk1.3\bin>javac jdeg.java D:jdk1.3\bin>java jdeg Enter the values(rno,name,dept,mark)to insert into the table 23 Ramki CSE 98 Rn 1 2 56 67 23 Name Arun Barathi Daniel Hareni Ramki Dept CSE EEE IT ECE CSE Mark 74 69 89 81 98
D:jdk1.3\bin>
RESULT:
Thus a JAVA program to implement embedded SQL has been executed successfully.
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 7 SQL>desc en2; Name ENO EADD employee Eno 1 NF emp 1 emp2 Eno eadd Eno Ename sal NORMALIZING THE TABLE TO 2 NF: SQL>create table ep1 as select eno,ename, from empproject; Table created. SQL>alter table ep1 add primary key(eno); Table altered. SQL>create table ep2 as select pno,pname from empproject; Table created. SQL>alter table ep2 add primary key(pno); Table altered. SQL>create table ep3 as select eno,pno,hours from empproject; Table created. SQL>alter table ep3 add constraint e3 primary key(eno); Table altered. SQL>alter table ep3 add constraint e4 unique(pno); Table altered. Ename Eadd Sal Null? Type NUMBER (3) ADDR Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 7 Eno ename Pno 2 NF Ep1 eno Ep2 Ep3 eno Pno hours ename pno pname pname hours Date:
NORMALIZING THE TABLE TO 3 NF: SQL>create table ed1 as select eno,ename,sal,dno from empdept; Table created. SQL>alter table ed1 add primary key(eno); Table altered. SQL>create table ed2 as select dno,dname from empdept; Table created. SQL>alter table ed2 add primary key(dno); Table altered SQL>alter table ed1 add foreign key(dno) reference ed2(dno); Table altered.
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 7 Empdept Eno ename Date:
Dname
RESULT: Thus the database was designed using E-R diagram and Normailization
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 8 TABLE DESIGN: Table Name 1:Book Date:
NAME
BID BNAME AUTHOR PRICE NO OF COPIES AVAILABLE
TYPE
NIMBER(6) VARCHAR2(30) VARCHAR2(20) NUMBER(8,2) NUMBER(3)
FORM 1: Dim DB As Database Dim RS As recordset Private Sub Form_Load() Set DB =OpenDatabase(libdsn,false,false,ODBC;uid= ;pwd= Set RS =DB.OpenRecordset(select * from Book) Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) Text5.text=RS(4) End Sub ;)
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 8 Private Sub CLEAR_click() Text1.text= Text2.text= Text3.text= Text4.text= Text5.text= End Sub Private sub DELETE_Click() RS.DELETE MsgBoxthe record is deleted RS.MoveNext IfRS.EOF Then MsgBoxno more records Else Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) Text5.text=RS(4) End If End Sub Private Sub EXIT Click() End End Sub Private Sub INSERT_Click() RS .MOVELAST RS.AddNew RS(0)=Text1.Text RS(1) =Text2.Text RS(2)=Text3.Text RS(3)=Text4.Text RS(4)=Text5.Text RS.UPDATE End Sub Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 8 Private Sub MOVEFIRST_Click() RS.MOVEFIRST Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) Text5.text=RS(4) End Sub Private Sub SEARCH_Click() 1=InputBox(ENTER THE BID,FIND) RS.FindFirst[BID]-&I If RS.NoMatch Then MsgBoxno such records Else RS.MOVEFIRST Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) Text5.text=RS(4) End Sub Private Sub ISSUE_Click() If Val(Text5.Text)>=1 Then Form2.Show Else MsgBoxNO BOOKS AVAILABLE End If End Sub FORM2: Dim DB As Database Dim RS As recordset Private Sub Form_Load() Set DB =OpenDatabase(libdsn,false,false,ODBC;uid= ;pwd= Set RS =DB.OpenRecordset(select * from Book) Text1.Ttext=Form1.Text1 Text2.Text=Form1.Text2 Text3.Text=Form1.Text3 End Sub ;) Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 8 Private Sub ISSUE_Click() RS.AddNew RS(0)=Text1.Text RS(1) =Text2.Text RS(2)=Text3.Text RS(3)=Text4.Text RS(4)=Text5.Text RS(5)=Text6.Text RS.UPDATE RS.MOVELAST Form1.Text5=val(Form1.Text5)-1 End Sub Private Sub MOVELAST_Click() RS.MOVELAST Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) Text5.text=RS(4) End Sub Private sub NEXT_Click() RS.MoveNext IfRS.EOF Then MsgBoxno more records Else Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) Text5.text=RS(4) End If End Sub Private sub PREVIOUS_Click() RS.MovePrevious IfRS.EOF Then MsgBoxno more records Else Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 8 Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) Text5.text=RS(4) End If End Sub Private Sub UPDATE_Click() RS.Edit RS(0)=Text1.Text RS(1) =Text2.Text RS(2)=Text3.Text RS(3)=Text4.Text RS(4)=Text5.Text RS.UPDATE End Sub Private Sub MAINMENU_Click() Form1.Show Form2.Hide End Sub Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 9 TABLE DESIGN: Table Name :Banking Date:
NAME
ACNO NAME ADDRESS BALANCE FORM 1: Dim DB As Database Dim RS As recordset
TYPE
NUMBER(6) VARCHAR2(30) VARCHAR2(20) NUMBER(8,2)
Private Sub Form_Load() Set DB =OpenDatabase(BANKDSN,FALSE,FALSE,ODBC;UID= ;PWD= Set RS =DB.OpenRecordset(select * from Bank) Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) End Sub Private Sub CLEAR_click() Text1.text= Text2.text= Text3.text= Text4.text= End Sub
;)
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 9 Private sub DELETE_Click() RS.DELETE MsgBoxthe record is deleted RS.MoveNext IfRS.EOF Then MsgBoxno more records Else Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) End If End Sub Private Sub EXIT Click() End End Sub Private Sub FIRST_Click() RS .MoveFirst Text1.Text=RS(0) Text2.Text=RS(1) Text3.Text=RS(2) Text4.Text=RS(3) End Sub Private Sub INSERT_Click() RS.MoveLast RS.AddNew RS(0)=Text1.Text RS(1) =Text2.Text RS(2)=Text3.Text RS(3)=Text4.Text MsgBoxrecord is inserted RS.UPDATE End Sub Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 9 Private Sub LAST_Click() RS. MoveLast Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) End Sub Private Sub NEXT_Click() RS.Move Next If RS.EOF Then MsgBoxno more recfords Else Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) EndIf End Sub Private Sub PREVIOUS_Click() RS.Move Previous If RS.EOF Then MsgBoxno more recfords Else Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) EndIf End Sub Private Sub UPDATE_Click() RS.Edit RS(0)=Text1.Text RS(1) =Text2.Text RS(2)=Text3.Text RS(3)=Text4.Text RS.UPDATE MsgBoxrecord is inserted End Sub Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 9 Private Sub FIND_Click() 1=InputBox(ENTER THE ACNO,FIND) rs.FindFirst[ACNO]=&I If rs.NoMatch Then MsgBoxno such records Else Text1.text=RS(0) Text2.text=RS(1) Text3.text=RS(2) Text4.text=RS(3) EndIf End Sub Private Sub WITHDRAW_Click() Form2.Show End Sub Private Sub DEPOSIT_Click() Form3.Show End Sub FORM 2: Private Sub HOMEPAGE_Click() Form1.Show Form2.Hide End Sub Private Sub WITHDRAW_Click() Text2.Text=val(Form1.Text)-Text1.Text Form1.Text4=Text2.text End Sub End Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 9 FORM 3: Private Sub DEPOSIT_Click() Text2.Text=val(Form1.Text)+Text1.Text Form1.Text4=Text2.text End Sub Private Sub HOMEPAGE_Click() Form1.Show Form3.Hide End Sub Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO:10 TABLE DESIGN: Table Name :Employee Date:
NAME
EMPNO EMPNAME DESIGNATION DA HRA ADDRESS TA PF BASICPAY LOAN.Text=adodc1.Recordset.Fields(9) ADV.Text= adodc1.Recordset.Fields(10) TD.Text=adodc1.Recordset.Fields(11) GP.Text=adodc1.Recordset.Fields(12) NP.Text=adodc1.Recordset.Fields(13) End Sub PROGRAM TO VIEW: Private sub view_Click() Dim a As Integer On Error Go To err a=InputBox(enter the empno) Adodc1.Recordset.MOVEFIRST While Not Adodc1. Recordset.EOF If Adodc1.Recordset.Fields(0)=a Then fillt 1 Exit Sub End If Adodc1.Recordset.MOVENEXT Wend err: MsgBox(record doesnot exist) End Sub
TYPE
NUMBER(6) VARCHAR2(30) VARCHAR2(20) NUMBER(10) NUMBER(10) VARCHAR2(20) NUMBER(10) NUMBER(10) NUMBER(8,2)
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 10 Private sub MOVENEXT_Click() Adodc1.Recordset.MOVENEXT End Sub Private sub MOVEPREVIOUS_Click() Adodc1.Recordset.MOVEPREVIOUS End Sub PROGRAM TO SAVE: Private sub save_Click() Adodc1.Recordset.Update NAME1.Enabled=False NO.Enabled=False DESIG.Enabled=False B1.Enabled=False HRA.Enabled=False DA.Enabled=False OA.Enabled=False TA.Enabled=False LOAN.Enabled=False ADV.Enabled=False TD.Enabled=False GP.Enabled=False PF.Enabled=False NP.Enabled=False add.Enabled= True del.Enabled= True BASIC.Enabled= True edit.Enabled=True End Sub Fill function Public sub fillt() NO.Text=adodc1.Recordset.Fields(0) NAME.Text= adodc1.Recordset.Fields(1) DESIG.Text=adodc1.Recordset.Fields(2) MONYH.Text=adodc1.Recordset.Fields(14) B1.Text=adodc1.Recordset.Fields(3) Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 10 DA.Text=adodc1.Recordset.Fields(4) HRA.Text= adodc1.Recordset.Fields(5) OA.Text=adodc1.Recordset.Fields(6) TA.Text=adodc1.Recordset.Fields(7) PF.Text=adodc1.Recordset.Fields(8) LOAN.Text=adodc1.Recordset.Fields(9) ADV.Text= adodc1.Recordset.Fields(10) PROGRAM TO ADD: Private sub add_Click() NAME1.Enabled= True NO.Enabled= True DESIG.Enabled= True B1.Enabled= True HRA.Enabled= True DA.Enabled= True OA.Enabled= True TA.Enabled= True LOAN.Enabled= True ADV.Enabled= True TD.Enabled= True GP.Enabled= True PF.Enabled= True NP.Enabled= True save. Enabled=True NO.SetFocus MsgBoxnew record is added add. Enabled=False del.Enabled=False BASIC. Enabled=False edit. Enabled=False End Sub Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 10 PROGRAM TO CALCULATE ALLOWANCES: Private sub B1_LostFocus() If Val(B1.Text)<5000 Then DA.Text=Val(B1)*(20/100) HRA.Text= Val(B1)*(15/100) OA.Text= Val(B1)*(10/100) TA.Text=Val(B1)+Val(HRA)+Val(OA) PF.Text=Val(B1)*(5/100) Else DA.Text=Val(B1)*(25/100) HRA.Text= Val(B1)*(20/100) OA.Text= Val(B1)*(15/100) TA.Text=Val(DA)+Val(HRA)+Val(OA) PF.Text=Val(B1)*(5/100) End If End Sub Dim a As Integer a=InputBox(enter the empno) Adodc1.Recordset.MOVEFIRST While Not Adodc1.Recordset.EOF If Adodc1.Recordset.Fields(0)=a Then Fillt Exit Sub End If Adodc1.Recordset.MOVENEXT Wend MsgBoxrecord modify successfully add.Enabled=False del.Enabled=False BASIC. Enabled=False edit. Enabled=False End Sub Private Sub exit_Click() Unload Me End Sub Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO: 10 Private sub Form_Click() NAME1.Enabled= False NO.Enabled= False DESIG.Enabled= False B1.Enabled= False HRA.Enabled= False DA.Enabled= False OA.Enabled= False TA.Enabled= False LOAN.Enabled= False ADV.Enabled= False TD.Enabled= False GP.Enabled= False PF.Enabled= False NP.Enabled= False save. Enabled=True End Sub Private sub MOVEFIRST_Click() Adodc1.Recordset.MOVEFIRST End Sub Private sub MOVELAST_Click() Adodc1.Recordset.MOVELAST End Sub PROGRAM TO DELETE: Private Sub del_Click() Form.Caption=delete operation Dim a As Integer On Error Go To err a=InputBox(enter the empno) Adodc1.Recordset.MOVEFIRST While Not Adodc1.Recordset.EOF If Adodc1.Recordset.Fields(0)=a Then Adodc1.Recordset.Delete Exit Sub End If Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO:10 Adodc1.Recordset.MOVENEXT Wend MsgBoxrecord deleted err: MsgBoxrecord does not exists End Sub Private sub edit_Click() Form1.Caption=modify operation Adodc1.Recordset.Update NAME1.Enabled=True NO.Enabled= True DESIG.Enabled= True B1.Enabled= True HRA.Enabled= True DA.Enabled= True OA.Enabled= True TA.Enabled= True LOAN.Enabled= True ADV.Enabled= True TD.Enabled= True GP.Enabled= True PF.Enabled= True NP.Enabled= True save. Enabled=True NO.SetFocus Date:
INDIRA INSTITUTE OF ENGINEERING TECHNOLOGY PANDUR, THIRUVALLUR DIST EX NO:10 OUTPUT: Date:
RESULT: Thus employee payroll processing system was developed in visual basic