求助,关于记录删除
首先运行查找按钮查找到相关记录Private Sub CmdOK_Click()
Set rs = New ADODB.Recordset
sql = "SELECT * from domainname where 姓名 like '%" & Text1.Text & "%'"
rs.Open sql, conn, adOpenKeyset, adLockOptimistic
If Not rs.BOF And Not rs.EOF Then
rs.MoveFirst
Call Mainfrm.TxtView
Mainfrm.CmdDel.Enabled = True
Mainfrm.CmdUp.Enabled = True
Mainfrm.CmdDown.Enabled = True
Call Mainfrm.MSF
Unload Me
Else
MsgBox "要查找的用户不存在", , "提示!"
End If
End Sub
然后删除这条记录
Private Sub CmdDel_Click()
If Not rs.EOF And Not rs.BOF Then
rs.Delete
MsgBox "删除成功", , "提示!"
rs.Update
rs.MoveNext
' conn.Execute "delete from domainname where 姓名='" & TxtName.Text & "'"
If Not rs.BOF And Not rs.EOF Then
Call TxtView
Call MSF
Else
Call TxtNull
MSFlexGrid1.Clear
End If
End If
End Sub
删除不了,请帮忙看看