Anda di halaman 1dari 13

SQL> select * from employee;

ENO ENAME

AGE DEPT

---------- --------------- ---------- ----1 AAA 2 BBB 3 CCC 4 DDD 5 EEE SQL> 20 CSE 21 ECE 19 CIVIL 20 MECH 18 EEE

Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim cmd As New ADODB.Command

Private Sub cmdfirst_Click() rs.MoveFirst Text1.Text = rs.Fields(0).Value Text2.Text = rs.Fields(1).Value Text3.Text = rs.Fields(2).Value Text4.Text = rs.Fields(3).Value End Sub

Private Sub cmdlast_Click() rs.MoveLast Text1.Text = rs.Fields(0).Value Text2.Text = rs.Fields(1).Value Text3.Text = rs.Fields(2).Value Text4.Text = rs.Fields(3).Value End Sub

Private Sub cmdnext_Click() rs.MoveNext If rs.EOF = True Then rs.MoveFirst End If Text1.Text = rs.Fields(0).Value Text2.Text = rs.Fields(1).Value Text3.Text = rs.Fields(2).Value Text4.Text = rs.Fields(3).Value End Sub

Private Sub cmdprev_Click() rs.MovePrevious If rs.BOF = True Then rs.MoveLast End If Text1.Text = rs.Fields(0).Value Text2.Text = rs.Fields(1).Value Text3.Text = rs.Fields(2).Value Text4.Text = rs.Fields(3).Value End Sub

Private Sub Command1_Click() Unload Me End End Sub

Private Sub Form_Load() Adodc1.Visible = False cn.ConnectionString = "Provider=MSDASQL.1; Persist Security Info=False; User ID=scott; Password=tiger; Data Source=employee" cn.Open rs.CursorLocation = adUseClient rs.Open "employee", cn, adOpenDynamic, adLockOptimistic, adCmdTable Text1.Text = eno Text2.Text = ename Text3.Text = age Text4.Text = dept

End Sub

Private Sub Command1_Click() Text3.Text = Val(Text1.Text) + Val(Text2.Text) End Sub

Private Sub Command2_Click() Text3.Text = Val(Text1.Text) - Val(Text2.Text) End Sub

Private Sub Command3_Click() Text3.Text = Val(Text1.Text) * Val(Text2.Text) End Sub

Private Sub Command4_Click() Text3.Text = Val(Text1.Text) / Val(Text2.Text) End Sub

Private Sub Command5_Click() End End Sub

Ex. No : 8(i)

Triggers

SQL> create table class(no number(5), name varchar2(10),dept varchar2(18),age number(20)); Table created. SQL> insert into class values(&no,'&name','&dept',&age); SQL> / Enter value for num: 01 Enter value for name: hajara Enter value for dept: CSE Enter value for age: 16 old 1: insert into class values(&no,'&name','&dept',&age) new 1: insert into class values(01,'hajara','CSE',16) 1 row created.

SQL> / Enter value for num: 02 Enter value for name: safiya Enter value for dept: ECE Enter value for age: 18 old 1: insert into class values(&no,'&name','&dept',&age) new 1: insert into class values(02,'safiya','ECE',18) 1 row created.

SQL> / Enter value for num: 03 Enter value for name: rafiha Enter value for dept: EEE

Enter value for age: 19 old 1: insert into class values(&no,'&name','&dept',&age) new 1: insert into class values(03,'rafiha','EEE',19) 1 row created.

SQL> select * from class;

NO

NAME

DEPT

AGE

--------------------------------------------------------1 2 3 hajara safiya rafiha CSE ECE EEE 16 18 19

SQL> create trigger lower_dept1 2 before 3 insert or update of dept on class 4 for each row 5 begin 6 :new.dept:=lower(:new.dept); 7 end; 8 /

Trigger created. SQL> insert into class values(&no,'&name','&dept',&age); Enter value for name: oviya Enter value for num: 04 Enter value for dept: EEE

Enter value for age: 19 old 1: insert into class values(&no,'&name',&num,'&dept',&age) new 1: insert into class values(04,'oviya','EEE',19) 1 row created. SQL> select * from class; NO NAME DEPT AGE

-----------------------------------------------------1 2 3 4 hajara safiya rafiha oviya CSE ECE EEE eee 16 18 19 19

Private Sub cmdreport_Click() rptphone.Show End Sub

Anda mungkin juga menyukai