Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Error -2147217864 Row cannot be located for Updating

 
   Database Help (Home) -> Visual Basic -> ADO RSS
Next:  Implementin Greek languge to php website  
Author Message
viatorg

External


Since: Nov 18, 2004
Posts: 11



(Msg. 1) Posted: Thu Feb 10, 2005 2:40 pm
Post subject: Error -2147217864 Row cannot be located for Updating
Archived from groups: microsoft>public>vb>database>ado (more info?)

Hi all,

Getting the error message when updating a record.
"Error -2147217864 Row cannot be located for Updating. Some values
may have been changed since it was last read."

Doesn't happen all the time, just sometimes. If I update one record and then
move to a new record and try to update I get
that error.

VB6 application, and tried with the lastest ADO2.8
SQL Server 2000

I declare this on the top of the form:

Public WithEvents rsEdit As ADODB.Recordset

Load form event I have this:

Set CmdEdit = New ADODB.Command
CmdEdit.CommandText = "record_source"
CmdEdit.CommandType = adCmdStoredProc
CmdEdit.ActiveConnection = ConnAddtxt

Set rsEdit = New ADODB.Recordset
Set rsEdit.Source = CmdEdit
rsEdit.CursorType = adOpenStatic
rsEdit.LockType = adLockOptimistic
rsEdit.Open
rsEdit.MoveFirst

Set txtfield(0).DataSource = rsEdit
txtfield(0).DataField = "Col1"
Set DateAdd.DataSource = rsEdit
DateAdd.DataField = "Col2"
Set txtfield(2).DataSource = rsEdit
txtfield(2).DataField = "Col3"
etc......................and so on

rsEdit.MoveFirst
BMark = rsEdit.Bookmark

I can move through the records with buttons on the form with this:

Select Case Index

Case 0
rsEdit.MoveFirst
Case 1
rsEdit.MovePrevious
If rsEdit.BOF Then
rsEdit.MoveFirst
End If
Case 2
rsEdit.MoveNext
If rsEdit.EOF Then
rsEdit.MoveLast
End If
Case 3
rsEdit.MoveLast
End Select

I have an event for the recordset like this to just show a label where I'm
at in the recordset:

Private Sub rsEdit_MoveComplete(ByVal adReason As ADODB.EventReasonEnum,
ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal
pRecordset As ADODB.Recordset)

Label1.Caption = "Record: " & _
CStr(rsEdit.AbsolutePosition) & _
" of " & Str(rsEdit.RecordCount)

End Sub



I have a Update button on the form and this is part of what is there:

Dim CurrBookmark As Variant
CurrBookmark = rsEdit.Bookmark
rsEdit.Update
rsEdit.Requery
rsEdit.Bookmark = CurrBookmark


thanks
Gerry

 >> Stay informed about: Error -2147217864 Row cannot be located for Updating 
Back to top
Login to vote
viatorg

External


Since: Nov 18, 2004
Posts: 11



(Msg. 2) Posted: Fri Feb 11, 2005 11:40 am
Post subject: Re: Error -2147217864 Row cannot be located for Updating [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi all,

The problem was the primary key on the table.

thanks
GV




"gv" <viatorg.RemoveThis@musc.edu> wrote in message
news:%23UHiqL6DFHA.3924@TK2MSFTNGP09.phx.gbl...
 > Hi all,
 >
 > Getting the error message when updating a record.
 > "Error -2147217864 Row cannot be located for Updating. Some
 > values
 > may have been changed since it was last read."
 >
 > Doesn't happen all the time, just sometimes. If I update one record and
 > then
 > move to a new record and try to update I get
 > that error.
 >
 > VB6 application, and tried with the lastest ADO2.8
 > SQL Server 2000
 >
 > I declare this on the top of the form:
 >
 > Public WithEvents rsEdit As ADODB.Recordset
 >
 > Load form event I have this:
 >
 > Set CmdEdit = New ADODB.Command
 > CmdEdit.CommandText = "record_source"
 > CmdEdit.CommandType = adCmdStoredProc
 > CmdEdit.ActiveConnection = ConnAddtxt
 >
 > Set rsEdit = New ADODB.Recordset
 > Set rsEdit.Source = CmdEdit
 > rsEdit.CursorType = adOpenStatic
 > rsEdit.LockType = adLockOptimistic
 > rsEdit.Open
 > rsEdit.MoveFirst
 >
 > Set txtfield(0).DataSource = rsEdit
 > txtfield(0).DataField = "Col1"
 > Set DateAdd.DataSource = rsEdit
 > DateAdd.DataField = "Col2"
 > Set txtfield(2).DataSource = rsEdit
 > txtfield(2).DataField = "Col3"
 > etc......................and so on
 >
 > rsEdit.MoveFirst
 > BMark = rsEdit.Bookmark
 >
 > I can move through the records with buttons on the form with this:
 >
 > Select Case Index
 >
 > Case 0
 > rsEdit.MoveFirst
 > Case 1
 > rsEdit.MovePrevious
 > If rsEdit.BOF Then
 > rsEdit.MoveFirst
 > End If
 > Case 2
 > rsEdit.MoveNext
 > If rsEdit.EOF Then
 > rsEdit.MoveLast
 > End If
 > Case 3
 > rsEdit.MoveLast
 > End Select
 >
 > I have an event for the recordset like this to just show a label where I'm
 > at in the recordset:
 >
 > Private Sub rsEdit_MoveComplete(ByVal adReason As ADODB.EventReasonEnum,
 > ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal
 > pRecordset As ADODB.Recordset)
 >
 > Label1.Caption = "Record: " & _
 > CStr(rsEdit.AbsolutePosition) & _
 > " of " & Str(rsEdit.RecordCount)
 >
 > End Sub
 >
 >
 >
 > I have a Update button on the form and this is part of what is there:
 >
 > Dim CurrBookmark As Variant
 > CurrBookmark = rsEdit.Bookmark
 > rsEdit.Update
 > rsEdit.Requery
 > rsEdit.Bookmark = CurrBookmark
 >
 >
 > thanks
 > Gerry
 >
 >
 >
 >
 >
 ><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Error -2147217864 Row cannot be located for Updating 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Updating An ADO 2.6 Recordset With VB and Access - When I try to update my ADO Recordset like this: recSet.Fields(2).Value = strFileNum I get this: Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype. Error 3251 When I try t...

ADO Error -2147217864 ??? - Hi all, Sometimes I get the above error (ie. Row cannot be located for updating etc...) exactly on the RS.Update line below: Private Function UpdateRow(ByVal sTable As String, oFields As clsFields) As Boolean On Error GoTo trap_err Dim RS As...

VB SQL Statement Error - I am trying to run a SQL statement from a VB application and am receiving an error message. However, when I run a similar statement from Access using a query, I do not get the message and it executes successfully. The message received indicates that..

msadodc.ocx Error loading dll - A customer upgraded my program on an XP machine with Service Pack 2. The upgrade now uses msadodc.ocx and when the program hits the line of code that says "Set datLog.Recordset = rsLog" the program fails with a "Error loading dll" an...

runtime error 3021 and user permissions - I have a VB6 application that uses ADO 2.7 to access an Access2000 database. I have found on Windows XP and 2000, that if the user is not part of the administrators group, they receive: "runtime error 3021. Either BOF or EOF is true, or the current ...
   Database Help (Home) -> Visual Basic -> ADO All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]