Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

Delete record in database via adodc

$
0
0
The selected row on the datagrid was deleted but it is not reflecting in my database and pops up an error message "cannot delete from specified table"

here is my code..

Private Sub btnDel_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "Select * From tblUsers Where UT='Judge'", frmLogin.con, adOpenDynamic, adLockOptimistic
If MsgBox("Are you sure you want to remove Judge " & Adodc1.Recordset!FirstName & " " & Adodc1.Recordset!LastName & " to the Judge list?", vbYesNo, "Delete Record?") = vbYes Then
Set rs = Adodc1.Recordset
rs.Delete
Unload frmListJ
frmListJ.Show
End If
End Sub

can anyone help to solve this problem?
Thanks

Viewing all articles
Browse latest Browse all 21090

Trending Articles