I using the record setup to update the SQL data base, 99.99% the time works well. Recently I encountered an error message like following:
[Microsoft][ODBC SQL Server Driver][SQL Server]Optimistic concurrency check failed. The row was modified outside of this cursor
my questions are:
1. what this error message means, how it occurs (under what conditions)
2. how to recovery it after catch this type of error?
3. what is the best practice to do this?
4. Looking for your input and suggestions.
thanks
--------------------------
-----
Here is my code templet I am using.
dim rs_x as recordset
dim SQLStr as string
set rs_x = createobject("adodb.record
set")
on error goto sql_err
strSQL = "select * from a_table where fields = 'xxx'"
SQLStr = "select * from w_buff order by to_email"
rs_x.Open strSQL, conn_dbl, adOpenKeyset, adLockOptimistic
' I am using adLockOptimistic' control
if rs_x.bof = true and rs_x.eof = true then
rs_x.addNew
endif
rs_x.fields("x1") = "something"
rs_x.update
rs_x.close
exit sub
err_sql:
debug.print err.description
' handle the error
etc