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

ADO Error -2147217864 ???

 
   Database Help (Home) -> Visual Basic -> ADO RSS
Next:  font size  
Author Message
Ivan Debono

External


Since: Feb 24, 2004
Posts: 11



(Msg. 1) Posted: Sat Feb 12, 2005 3:40 am
Post subject: ADO Error -2147217864 ???
Archived from groups: microsoft>public>vb>database>ado (more info?)

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 ADODB.Recordset
Dim oField As ADODB.Field

Set RS = OpenRecordset("SELECT * FROM " & sTable & " WHERE id = " &
oFields("id"), adOpenKeyset, adLockPessimistic)
If Not RS Is Nothing Then
'Fill the recordset fields
For Each oField In RS.Fields
If oField.Name <> "id" Then
Debug.Print oField.Name, oFields(oField.Name).Value
If Not IsEmpty(oFields(oField.Name).Value) Then
Select Case oField.Type
Case adDate
If oFields(oField.Name).Value = vbNullString
Then
oField.Value = Null
Else
oField.Value = oFields(oField.Name).Value
End If

Case adSmallInt, adTinyInt, adUnsignedBigInt,
adUnsignedInt, adUnsignedSmallInt, adUnsignedTinyInt
oField.Value = Val(oFields(oField.Name).Value)

Case Else
oField.Value = oFields(oField.Name).Value
End Select
End If
End If
Next oField

'Update the recordset
RS.Update
UpdateRow = True
End If

trap_err_exit:
Set oField = Nothing
Set RS = Nothing
Exit Function

trap_err:
UpdateRow = False
msError = "(" & Err.Number & ") " & Err.Description
#If DEBUGLOG = 1 Then
If Not oField Is Nothing Then
LogWrite "Field: " & sTable & "." & oField.Name & " - " &
msError
Else
LogWrite "Table: " & sTable & " - " & msError
End If
#End If
Resume trap_err_exit

End Function

It happens only in particular occasions and I can't figure out why. Anybody
encountered this problem before?

Thanks,
Ivan

 >> Stay informed about: ADO Error -2147217864 ??? 
Back to top
Login to vote
Mark J. McGinty

External


Since: Aug 31, 2003
Posts: 30



(Msg. 2) Posted: Mon Feb 14, 2005 4:59 am
Post subject: Re: ADO Error -2147217864 ??? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The code is missing relevant details, where is AddNew called, and is Update
called for the same record at any other point before the record pointer is
moved? If so you need to set the dynamic property

RS.Properties("Change Inserted Rows") = True

after creating but before opening the recordset.


-Mark





"Ivan Debono" <ivanmdeb RemoveThis @hotmail.com> wrote in message
news:uxQOdLNEFHA.1296@TK2MSFTNGP10.phx.gbl...
 > 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 ADODB.Recordset
 > Dim oField As ADODB.Field
 >
 > Set RS = OpenRecordset("SELECT * FROM " & sTable & " WHERE id = " &
 > oFields("id"), adOpenKeyset, adLockPessimistic)
 > If Not RS Is Nothing Then
 > 'Fill the recordset fields
 > For Each oField In RS.Fields
 > If oField.Name <> "id" Then
 > Debug.Print oField.Name, oFields(oField.Name).Value
 > If Not IsEmpty(oFields(oField.Name).Value) Then
 > Select Case oField.Type
 > Case adDate
 > If oFields(oField.Name).Value = vbNullString
 > Then
 > oField.Value = Null
 > Else
 > oField.Value = oFields(oField.Name).Value
 > End If
 >
 > Case adSmallInt, adTinyInt, adUnsignedBigInt,
 > adUnsignedInt, adUnsignedSmallInt, adUnsignedTinyInt
 > oField.Value = Val(oFields(oField.Name).Value)
 >
 > Case Else
 > oField.Value = oFields(oField.Name).Value
 > End Select
 > End If
 > End If
 > Next oField
 >
 > 'Update the recordset
 > RS.Update
 > UpdateRow = True
 > End If
 >
 > trap_err_exit:
 > Set oField = Nothing
 > Set RS = Nothing
 > Exit Function
 >
 > trap_err:
 > UpdateRow = False
 > msError = "(" & Err.Number & ") " & Err.Description
 > #If DEBUGLOG = 1 Then
 > If Not oField Is Nothing Then
 > LogWrite "Field: " & sTable & "." & oField.Name & " - " &
 > msError
 > Else
 > LogWrite "Table: " & sTable & " - " & msError
 > End If
 > #End If
 > Resume trap_err_exit
 >
 > End Function
 >
 > It happens only in particular occasions and I can't figure out why.
 > Anybody encountered this problem before?
 >
 > Thanks,
 > Ivan
 ><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: ADO Error -2147217864 ??? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
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...

Error -2147217864 Row cannot be located for Updating - 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...

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 ...

error converting the varchar value 'True' to a column of d.. - In a vb6 app using ado connecting to a sql server 2000 stored procedure, am seeing this error: "Syntax error converting the varchar value 'True' to a column of data smallint" The error only seems to happen when updating one record. Other reco...
   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 ]