Saturday, August 22, 2009

how to search and delete a record in vb6

Option Explicit


Private Sub cmdSearch_Click()

Adodc1.RecordSource = "SELECT * FROM tblStudent where Lastname = ' " '& Text1.Text & " ' "
Adodc1.Refresh

If Adodc1.Recordset.RecordCount = 0 Then
'Timer1.Enabled = True
MsgBox "type the lastname to search wala"
End If

End Sub


Private Sub cmdDelete_Click()

Prompt$ = "Do you really want to delete?"
reply = MsgBox(Prompt$, vbOKCancel, "Delete Record")

If reply = vbOK Then
    Adodc1.Recordset.Delete
    Adodc1.Recordset.MoveNext
End If

End Sub

No comments:

Post a Comment