You are on page 1of 3

MARKSHEET PROCESSING

DECLARATION :
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim i As Integer
Dim j As Integer
FORM LOAD:
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open ("Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True")
rs.Open ("select * from maa"), cn, adOpenDynamic
End Sub
INSERTION:
Private Sub Command1_Click()
If (Text1.Text = " " Or Text2.Text = " " Or Text3.Text = " " Or Text4.Text = " " Or Text5.Text = " " Or
Text6.Text = " " Or Text7.Text = " " Or Text8.Text = " " Or Text9.Text = " " Or Text10.Text = " ") Then
MsgBox ("Enter the data")
Else
cn.Execute ("insert into maa values('" & Val(Text1.Text) & "','" & (Text2.Text) & "','" & Val(Text3.Text)
& "','" & Val(Text4.Text) & "','" & Val(Text5.Text) & "','" & Val(Text6.Text) & "','" & Val(Text7.Text)
& "','" & Val(Text8.Text) & "','" & Val(Text9.Text) & "','" & Val(Text10.Text) & "')")
MsgBox ("inserted")
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
End If
End Sub
DELETION:
Private Sub Command4_Click()
i = InputBox("enter the value to delete")
cn.Execute ("select * from maa where regno='" & Val(i) & "'")
cn.Execute ("delete from maa where regno='" & Val(i) & "'")
MsgBox ("deleted")
End Sub
MODIFY:
Private Sub modify_Click()
j = InputBox("enter the regno to modify")
cn.Execute ("select * from maa where regno=('" & Val(j) & "')")
rs.Find "regno=" & Str(j)
If (rs.EOF) Then
MsgBox ("record not found")
Else
Text1.Text = rs(0)
Text2.Text = rs(1)
Text3.Text = rs(2)
Text4.Text = rs(3)
Text5.Text = rs(4)
Text6.Text = rs(5)
Text7.Text = rs(6)
Text8.Text = rs(7)
Text9.Text = rs(8)
Text10.Text = rs(9)
End If
modify.Enabled = False
End Sub
UPDATE:
Private Sub Command3_Click()
cn.Execute ("update maa set regno=('" & (Text1.Text) & "') where regno=('" & Val(Text1.Text) & "')")
cn.Execute ("update maa set name=('" & (Text2.Text) & "')where regno=('" & Val(Text1.Text) & "')")
cn.Execute ("update maa set m1=('" & (Text3.Text) & "')where regno=('" & Val(Text1.Text) & "')")
cn.Execute ("update maa set m2=('" & (Text4.Text) & "')where regno=('" & Val(Text1.Text) & "')")
cn.Execute ("update maa set m3=('" & (Text5.Text) & "')where regno=('" & Val(Text1.Text) & "')")
cn.Execute ("update maa set m4=('" & (Text6.Text) & "')where regno=('" & Val(Text1.Text) & "')")
cn.Execute ("update maa set m5=('" & (Text7.Text) & "')where regno=('" & Val(Text1.Text) & "')")
cn.Execute ("update maa set tot=('" & (Text8.Text) & "')where regno=('" & Val(Text1.Text) & "')")
cn.Execute ("update maa set avg=('" & (Text9.Text) & "')where regno=('" & Val(Text1.Text) & "')")
cn.Execute ("update maa set grade=('" & (Text10.Text) & "')where regno=('" & Val(Text1.Text) & "')")
MsgBox ("record updated")
Command4.Enabled = True
End Sub
REPORT:
Private Sub REPORT_Click()
DataReport1.Show
End Sub
EXIT:
Private Sub Command6_Click()
Unload Me
End Sub
CALCULATION:
Private Sub Text10_Click()
If (Text9.Text > 60) Then
Text10.Text = "1"
MsgBox ("1 grade")
Else
Text10.Text = "2"
MsgBox ("2 grade")
End If
End Sub
Private Sub Text8_Click()
Text8.Text = Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text)
End Sub
Private Sub Text9_Click()
Text9.Text = Val(Text8.Text) / 5 End Sub
OUTPUT:

INSERT:

DATA REPORT:

You might also like