The record was changed by another user while trying to send or change

I am developing an application using Delphi 7 and Sql Server express 2008 R2 ; I am using BDE to connect an Sql server through ODBC and my own SQL client . > used for driver.

In some specific forms of the table component raise EDBEngineError "The record was changed by another user", just try to add data, the same problem occurs when table.cancel , table.post , table.edit .....

A few days before I changed the driver from SQL Server to Sql Native Client , due to the SQL server having a problem with "the connection has a result set for another hstmt", I changed it to my own SQL client, forming this, I met this error "Record was modified by antoher user error".

Please, help

+4
source share
2 answers
  • BDE has not been updated for a long time. And the native SQL client is updated regularly. You may have encountered incompatibilities between BDE and SQLNC v 10.5.
  • “Record was changed by another user” means that the API returned <> 1 updated records, for example 0 records. In most cases, this does not mean that some user has changed the record. The number of updated records is returned as a separate message, so if the connection is occupied by other messages, it can return 0. If your tables have triggers, try adding SET NOCOUNT ON at the top of the trigger.
  • "Connection busy with result set for another hstmt" means that you did not retrieve all records from the active result set. You can try fetching all the records.
  • To avoid all these errors, consider migrating to the dbExpress or 3d party library, such as AnyDAC .

Supplement to (2): Another classic reason for "Record was changed by another user." The WHERE phrase includes a field and the corresponding parameter that do not correspond to accuracy (for example, accuracy is lost on the client side), have different formats (for example, incompatible character sets), etc. You should check the SQL command and parameter values ​​sent to SQL Server using SQL Profiler.

+5
source

Friend, you should consider updating your development tools. For this problem, you really need to work with the ZEOS component for Delphi. It can connect to many databases, including Firebird, MySQL, Access, and SQL Server. All you have to do is place the database DLL that you use in your project directory and manage bin delphi (if there is no database manager on the target computer). Then you let the database server monitor transactions. If you need more information, just give me a signal.

0
source

Source: https://habr.com/ru/post/1393755/


All Articles