在写数据库的过程重,大家遇到过这样的错误“Row cannot be located for updating.Som values may have been changed since it was last read.”吗?
怎么解决呀?

解决方案 »

  1.   

    没有遇到过,我用过SQLServer,Access,都没有碰到过,能详细说一直过程吗?
      

  2.   

    好像当更新一条记录时,数据库会产生类似这样的sql:
      Update table fieldname set Values (newFieldValue) where fieldValue = OldFieldValue
      我觉得这个问题好像是说,当你从服务器得到这些数据后,在你更新以前,你要更新的一些记录已经被别的用户更新了。
      

  3.   

    我在http://support.microsoft.com/default.aspx?scid=KB;en-us;q270636找到这个
    When you call the UpdateBatch method of an ActiveX Data Objects (ADO) Recordset object using the Microsoft OLE DB Provider for Oracle, an error may occur.With Microsoft Data Access Components (MDAC) version 2.5, the following error message may be returned: Run-time error '-2147217864 (80040e38)':
    Row cannot be located for updating. Some values may have been changed since it was last read. 
    With MDAC version 2.1, the following error message may be returned: Run-time error '-2147217864 (80040e38)':
    The specified row could not be located for updating: Some values may have been changed since it was last read. 
    CAUSE
    When you have an out-of-process DLL in a 3-tier application, and the DLL is responsible for handling updates to the Oracle server, the following sequence of events may cause this error to occur:The DLL returns an ADO Recordset to the client.
    The client appends a new record to the Recordset and sends the Recordset back to the DLL.
    The DLL calls UpdateBatch to commit the changes to the Recordset.
    The client modifies the new record and sends the Recordset to the DLL again.
    When the DLL calls UpdateBatch again, the error occurs.
    The root problem is that a hidden ROWID column in the Recordset is still set to NULL after the first update on the client-side Recordset. This is because ROWID columns are automatically incremented by the server, and in this case, the client-side Recordset is disconnected; in other words, it has no server connection and therefore cannot be updated automatically. Because this column value is never updated on the client-side, all subsequent updates using this invalid ROWID fail. 
      

  4.   

    http://www.textcontrol.com/tx/newsgroups/borland_public_delphi_database_ado/2001/11/24/0019.htm
      

  5.   

    使用Microsoft OLE DB Provider for Oracle调用ActiveX Data Objects (ADO)
    Recordset object 的UpdateBatch方法时,可能会发生错误。
    如果使用Microsoft Data Access Components (MDAC) version 2.5, 可能会返回以下
    错误:
    Run-time error '-2147217864 (80040e38)':
    Row cannot be located for updating. Some values may have been changed since
    it was last read.
    (运行错误'-2147217864 (80040e38)':行无法定位。自上次读取后有些值可能已改变。)
    如果使用MDAC version 2.1, 可能会返回以下错误:
    Run-time error '-2147217864 (80040e38)':
    The specified row could not be located for updating: Some values may have
    been changed since it was last read.(运行错误'-2147217864 (80040e38)':指定行无法定位:自上次读取后有些值可能已改变。)
    原因当3-tier应用程序中有一非运行中的DLL,并且该DLL是负责Oracle服务器的更新的,以
    下一系列事件可能会导致错误的发生:  1.. DLL返回ADO Recordset至服务器。
      2.. 服务器添加一新记录至Recordset并将Recordset 发送回DLL。
      3.. DLL调用UpdateBatch,提交变化至Recordset。
      4.. 客户端修改新的记录并再次将Recordset 发送回DLL
      5.. 当DLL再次调用UpdateBatch时,错误发生。根本问题是Recordset 中的隐藏ROWID列在客户端Recordset第一次更新后仍然设为
    NULL。这是因为ROWID列是由服务器自动增加的。这种情况下,客户端Recordset是断开
    的。也就是说,它没有与服务器连接,因此无法自动更新。因为该列在客户端从来没有
    更新过,所以所有使用该无效ROWID的后续的更新都会失败。
      

  6.   

    是否主键信息不全?---全
    更新后的记录存在多条,数据库无法定位?---你是指重复记录么,哪没有。我加了条件限制
    你可曾查看数据库中记录是否已经被更新了?---不知道,无法查看,因为
    程序work1,work2,work3写入的数据是采集卡采集来得(以我的观察应该更新了)
    如果被更新了,是否有多条记录都被同时更新了?
      

  7.   

    楼主啊,你以前不是也提过同样的问题吗?只不过这次换成了英文的提示而已啊,这是你以前问的:
    http://expert.csdn.net/Expert/topic/1124/1124168.xml?temp=.6032221
      

  8.   

    CSDN怎么啦,我回答过的帖子不是说找不到文件就是缺了N个回复,真TMD的!