为什么,能增加新记录,却不能更新旧记录?
Dim cnDbf As ADODB.Connection
Dim rsCb As ADODB.Recordset
Dim strPath As String
Dim strSql As String
Screen.MousePointer = 11
strPath = App.Path + "\drp"
Set cnDbf = New ADODB.Connection
strSql = "Provider=MSDASQL.1;Driver={Microsoft dBase Driver (*.dbf)};DBQ=" + strPath
cnDbf.Open strSql
strSql = "SELECT * FROM cb"
Set rsCb = New ADODB.Recordset
rsCb.CursorLocation = adUseClient
rsCb.Open strSql, cnDbf, adOpenStatic, adLockOptimistic
Screen.MousePointer = 0
' rsCb!tzyx = 10
' rsCb.Update '不能通过,报错
' rsCb.AddNew
' rsCb!tzyx = 10
' rsCb.Update 能通过
报错内容:
实时错误 '-2147467259(80004005)':
[Microsoft][ODBC dBase Driver] 操作必须使用一个可更新的查询。