Search Here

VB Static Form design

VB – ORACLE CONNECTION CODE (Static)
VB form static
Include ADODC Component:
Project àComponents à Microsoft ADO Data control
--------------------------------------------Code for ADD--------------------------------------------
Private Sub Form_Load()
Command1.Caption = "ADD"
End Sub
Private Sub Command1_Click()
If (Command1.Caption = "ADD") Then
    Adodc1.Recordset.AddNew
    Command1.Caption = "UPDATE"
    Text1.SetFocus
Else
    Adodc1.Recordset.Update
    MsgBox ("Successfully Add")
    Command1.Caption = "ADD"
End If
End Sub
--------------------------------------------Code for UPDATE--------------------------------------------
Private Sub Command2_Click()
    Adodc1.Recordset.Update
    MsgBox ("Successfully Update")
End Sub
--------------------------------------------Code for DELETE--------------------------------------------
Private Sub Command7_Click()
If (Adodc1.Recordset.RecordCount > 0) Then
    Adodc1.Recordset.Delete
    MsgBox ("Successfully Delete")
Else
    MsgBox ("Database Empty")
End If
End Sub
--------------------------------------------Code for Begin--------------------------------------------
Private Sub Command6_Click()
If (Adodc1.Recordset.RecordCount > 0) Then
    Adodc1.Recordset.MoveFirst
Else
    MsgBox ("Database Empty")
End If
End Sub
--------------------------------------------Code for NEXT--------------------------------------------
Private Sub Command3_Click()
If (Adodc1.Recordset.EOF) Then
    MsgBox ("End of File")
Else
    Adodc1.Recordset.MoveNext
End If
End Sub
--------------------------------------------Code for PREVIOUS--------------------------------------------
Private Sub Command4_Click()
If (Adodc1.Recordset.BOF) Then
    MsgBox ("Begin of File")
Else
    Adodc1.Recordset.MovePrevious
End If
End Sub
--------------------------------------------Code for End--------------------------------------------
Private Sub Command5_Click()
If (Adodc1.Recordset.RecordCount > 0) Then
    Adodc1.Recordset.MoveLast
End If
End Sub
--------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment