Anda di halaman 1dari 14

SQL> desc library

Name Null? Type


----------------------------------------- --------
----------------------------
BNAME VARCHAR2(25)
BNO NUMBER(7)
AUTHOR VARCHAR2(25)
EDITION VARCHAR2(15)
PUB VARCHAR2(25)
STATUS VARCHAR2(15)
ISSUED_TO VARCHAR2(25)
ISDATE DATE
REDATE DATE

//form1
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim status As String
Dim str As String
Dim bno As Integer

Public Function clear()


TxtAut.Text = ""
TxtEdi.Text = ""
TxtIsDa.Text = ""
TxtIsTo.Text = ""
TxtPub.Text = ""
TxtReDa.Text = ""
TxtName.Text = ""
TxtIdNo.Text = ""
Me.Hide
Form3.Show

End Function
Public Function lockvisible()
TxtAut.Visible = False
TxtEdi.Visible = False
TxtPub.Visible = False
TxtName.Visible = False
RadIss.Visible = False
RadAvi.Visible = False
End Function
Public Function unlockvisible()
TxtAut.Visible = True
TxtEdi.Visible = True
TxtPub.Visible = True
TxtName.Visible = True
RadIss.Visible = True
RadAvi.Visible = True

End Function

Private Sub ButAddTab_Click()


ButViewTab.Visible = True
ButAddTab.Visible = False
ButMdyTab.Visible = True
ButDelTab.Visible = True
RadAvi.Value = True
ButAll.Visible = False
ButStore.Visible = True
ButNext.Visible = True
ButDel.Visible = False
ButSearch.Visible = False
ButUpdate.Visible = False
unlockvisible
End Sub

Private Sub ButAll_Click()


Me.Hide
Form2.Show
End Sub

Private Sub ButDel_Click()


If ((TxtIdNo.Text = "")) Then
str = MsgBox("Error:Fields Empty...", vbOKOnly + vbCritical, "Error")
Else
con.Open
"DSN=siva;UID=SCOTT;PWD=TIGER;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10
;LOB=T;RST=T;GDE=F;FRL=F;BAM=IfAllSuccessful;MTS=F;MDI=F;CSR=F;FWC=F;PFC=
10;TLO=0;"
str = "delete from library where bno=" & TxtIdNo.Text & ""
rs.Open str, con, adOpenDynamic, adLockOptimistic
con.Close
str = MsgBox("Value Deleted Successfully..", vbOKOnly + vbInformation,
"Conformation Messasge")
End If
clear
RadAvi.Value = True
lockvisible
End Sub

Private Sub ButDelTab_Click()


ButViewTab.Visible = True
ButAddTab.Visible = True
ButMdyTab.Visible = True
ButDelTab.Visible = False
ButAll.Visible = False
lockvisible
RadAvi.Value = True

ButAll.Visible = False
ButStore.Visible = False
ButNext.Visible = True
ButDel.Visible = False
ButSearch.Visible = True
ButUpdate.Visible = False
End Sub

Private Sub ButMdyTab_Click()


ButViewTab.Visible = True
ButAddTab.Visible = True
ButMdyTab.Visible = False
ButDelTab.Visible = True
lockvisible
RadAvi.Value = True

ButAll.Visible = False
ButStore.Visible = False
ButNext.Visible = True
ButDel.Visible = False
ButSearch.Visible = True
ButUpdate.Visible = False
End Sub

Private Sub ButNext_Click()


clear
RadAvi.Value = True
lockvisible
If ButAddTab.Visible = False Then
unlockvisible
End If
End Sub

Private Sub ButSearch_Click()


con.Open
"DSN=siva;UID=SCOTT;PWD=TIGER;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10
;LOB=T;RST=T;GDE=F;FRL=F;BAM=IfAllSuccessful;MTS=F;MDI=F;CSR=F;FWC=F;PFC=
10;TLO=0;"

If ((TxtIdNo.Text = "") Or ((Asc(TxtIdNo.Text) < 48 Or Asc(TxtIdNo.Text)


> 57))) Then
MsgBox " Please enter the book id number", vbCritical
Else

str = " select * from library where bno= " & TxtIdNo & ""
rs.Open str, con, adoopendynamic, adLockOptimistic
If Not rs.EOF Then
unlockvisible
TxtName.Text = rs.Fields(0)
TxtIdNo.Text = rs.Fields(1)
TxtAut.Text = rs.Fields(2)
TxtEdi.Text = rs.Fields(3)
TxtPub.Text = rs.Fields(4)
status = rs.Fields(5)
bno = rs.Fields(1)
If status = "Issued" Then
RadIss.Value = True

TxtIsTo.Text = rs.Fields(6)
TxtIsDa.Text = rs.Fields(7)
TxtReDa.Text = rs.Fields(8)

Else
RadAvi.Value = True

End If
If ButMdyTab.Visible = False Then
ButUpdate.Visible = True
End If
If ButDelTab.Visible = False Then
ButDel.Visible = True
End If
Else
MsgBox " No such data", vbInformation
End If
rs.Close
End If
con.Close

End Sub

Private Sub ButStore_Click()

If ((TxtAut.Text = "") Or (TxtEdi.Text = "") Or (TxtPub.Text = "") Or


(TxtName.Text = "") Or (TxtIdNo.Text = "")) Or ((RadIss.Value = True) And
((TxtIsDa.Text = "") Or (TxtIsTo.Text = "") Or (TxtReDa.Text = ""))) Then
str = MsgBox("Error:Fields Empty...", vbOKOnly + vbCritical, "Error")
Else
If RadIss.Value = True Then
status = "Issued"
Else
status = "Available"
End If
con.Open
"DSN=siva;UID=SCOTT;PWD=TIGER;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10
;LOB=T;RST=T;GDE=F;FRL=F;BAM=IfAllSuccessful;MTS=F;MDI=F;CSR=F;FWC=F;PFC=
10;TLO=0;"
str = "insert into library values('" & TxtName.Text & "'," & TxtIdNo.Text
& ",'" & TxtAut.Text & "','" & TxtEdi.Text & "','" & TxtPub.Text & "','"
& status & "','" & TxtIsTo & "','" & TxtIsDa & "','" & TxtReDa & "')"
rs.Open str, con, adOpenDynamic, adLockOptimistic
con.Close
str = MsgBox("Value Stored Successfully..", vbOKOnly + vbInformation,
"Conformation Messasge")
End If
End Sub

Private Sub ButUpdate_Click()


If ((TxtIdNo.Text = "")) Then
str = MsgBox("Error:Fields Empty...", vbOKOnly + vbCritical, "Error")
Else
If RadIss.Value = True Then
status = "Issued"
Else
status = "Available"
End If
con.Open
"DSN=siva;UID=SCOTT;PWD=TIGER;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10
;LOB=T;RST=T;GDE=F;FRL=F;BAM=IfAllSuccessful;MTS=F;MDI=F;CSR=F;FWC=F;PFC=
10;TLO=0;"
str = "update library set bname='" & TxtName.Text & "',bno=" &
TxtIdNo.Text & ",author='" & TxtAut.Text & "',edition='" & TxtEdi.Text &
"',pub='" & TxtPub.Text & "',status='" & status & "',issued_to='" &
TxtIsTo.Text & "',isdate='" & TxtIsDa.Text & "',redate='" & TxtReDa.Text
& "' where bno=" & bno & ""
rs.Open str, con, adOpenDynamic, adLockOptimistic
con.Close
str = MsgBox("Value Updated Successfully..", vbOKOnly + vbInformation,
"Conformation Messasge")
End If
End Sub

Private Sub ButViewTab_Click()


ButViewTab.Visible = False
ButAddTab.Visible = True
ButMdyTab.Visible = True
ButDelTab.Visible = True
lockvisible
RadAvi.Value = True

ButAll.Visible = True
ButStore.Visible = False
ButNext.Visible = True
ButDel.Visible = False
ButSearch.Visible = True
ButUpdate.Visible = False
End Sub

Private Sub RadAvi_Click()


LabIsDa.Visible = False
LabIsTo.Visible = False
LabReDa.Visible = False
TxtIsDa.Visible = False
TxtIsTo.Visible = False
TxtReDa.Visible = False
End Sub

Private Sub RadIss_Click()


LabIsDa.Visible = True
LabIsTo.Visible = True
LabReDa.Visible = True
TxtIsDa.Visible = True
TxtIsTo.Visible = True
TxtReDa.Visible = True
End Sub

//form2

Private Sub ButBak_Click()


Me.Hide
Form1.Show

End Sub

//form3

Private Sub ButOk_Click()


If ((TxtUid.Text = "student") And (Tetpw.Text = "student")) Then
Me.Hide
Form1.Show
Else
MsgBox "Invalid user name or password", vbOKOnly + vbCritical
End If
End Sub

Anda mungkin juga menyukai