Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

GAS BOOKING PROCESSING

FORM1:
DECLARATION
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
INSERT
Private Sub Command1_Click()
If ((Text1.Text = " ") Or (Text2.Text = " ") Or (Text3.Text = " ") Or (Text4.Text = " ") Or
(Text5.Text = " ")) Then
MsgBox ("enter the data")
Else
cn.Execute ("insert into customer values('" & Val(Text1.Text) & "','" & (Text2.Text) & "','" &
(Text3.Text) & "','" & Val(Text4.Text) & "','" & Val(Text5.Text) & "')")
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
MsgBox ("inserted")
End If
End Sub
DELETE
Private Sub Command2_Click()
Dim i As Integer
i = InputBox("enter the cusid you want to delete")
cn.Execute ("delete from customer where cusid='" & Val(i) & "' ")
MsgBox ("deleted")
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
End Sub
MODIFY
Private Sub Command3_Click()
Dim j As Integer
j = InputBox("enter the cusid you want to modify")
rs.Find "cusid=" & 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)
End If
End Sub

UPDATE
Private Sub Command4_Click()
cn.Execute ("update customer set cusid='" & Val(Text1.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
cn.Execute ("update customer set name='" & (Text2.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
cn.Execute ("update customer set address='" & (Text3.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
cn.Execute ("update customer set phno='" & Val(Text4.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
cn.Execute ("update customer set permitno='" & Val(Text5.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
MsgBox ("update")
End Sub
NEXT FORM
Private Sub Command5_Click()
Form2.Show
End Sub
EXIT
Private Sub Command6_Click()
End
End Sub
FORM LOAD
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open ("Provider=MSDAORA.1;Password=manager;User ID=system;Persist Security
Info=True")
rs.Open ("select * from customer"), cn, adOpenDynamic, adLockOptimistic, Adodc1.Visible =
False
End Sub
FORM2:
DECLARATION
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
INSERT
Private Sub Command1_Click()
If ((Text1.Text = " ") Or (Text2.Text = " ") Or (Text3.Text = " ") Or (Text4.Text = " ") Or
(Text5.Text = " ")) Then
MsgBox ("enter the data")
Else
cn.Execute ("insert into booking values('" & Val(Text1.Text) & "','" & Val(Text2.Text) & "','" &
(Text3.Text) & "','" & (Text4.Text) & "','" & Val(Text5.Text) & "')")
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
MsgBox ("inserted")
End If
End Sub

DELETE
Private Sub Command2_Click()
Dim i As Integer
i = InputBox("enter the cusid you want to delete")
cn.Execute ("delete from booking where cusid='" & Val(i) & "' ")
MsgBox ("deleted")
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
End Sub
MODIFY
Private Sub Command3_Click()
Dim j As Integer
j = InputBox("enter the cusid you want to modify")
rs.Find "cusid=" & 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)
End If
End Sub
UPDATE
Private Sub Command4_Click()
cn.Execute ("update booking set cusid='" & Val(Text1.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
cn.Execute ("update booking set billno='" & Val(Text2.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
cn.Execute ("update booking set regdate='" & (Text3.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
cn.Execute ("update booking set issuedate='" & (Text4.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
cn.Execute ("update booking set amount='" & Val(Text5.Text) & "' where cusid='" &
Val(Text1.Text) & "' ")
MsgBox ("update")
End Sub
DATA REPORT
Private Sub Command5_Click()
DataReport1.Show
End Sub
EXIT
Private Sub Command6_Click()
End
End Sub
FORM LOAD
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open ("Provider=MSDAORA.1;Password=manager;User ID=system;Persist Security
Info=True")
rs.Open ("select * from booking"), cn, adOpenDynamic, adLockOptimistic, Adodc1.Visible =
False
End Su
OUTPUT:
DATA REPORT:

You might also like