我在这个主题上似乎一无所知。我可以将ADO记录集附加到表单上,但我不确定如何处理更新。我不想只使用UpdateBatch,我想能够检测到更改以进行日志记录。有人可以指点我正确的方向吗?
提供的SQL包含一个名为“ID”的自动编号键字段。
Private Sub Form_Load()
Dim rst as Object
Set rst = CreateObject("ADODB.Recordset")
rst.CursorLocation = adUseClient
'...edit out connection
rst.Open sql, mConnection, adOpenStatic, adLockBatchOptimistic
set rst.ActiveConnection = Nothing
Set Me.Recordset = rst
End Sub
''Edit records on the form and now click save
Private Sub cmdSave_Click()
Dim rst As Object
Set rst = Me.Recordset
Set rst.ActiveConnection = GetConnection
rst.UpdateBatch
'How do I detect deleted, added, or modified records for logging?
End Sub