Solved

Error -2147217885 using ODBC ADO VB and Oracle

Posted on 2002-03-29
17
862 Views
Last Modified: 2007-11-27
Hi,

I'm having a problem here with disconnected recordsets.
The key is a sequence in Oracle and i use the Microsoft ODBC driver for Oracle

First part:

        With rsDefinition
          .CursorLocation = adUseClient
          .Properties("Update Criteria").Value = adCriteriaAllCols
          .Properties("Update Resync").Value = adResyncInserts Or adResyncUpdates Or adResyncAutoIncrement
          .Open strSQL, DB_CONNECT, adOpenStatic, adLockBatchOptimistic
          Set .ActiveConnection = Nothing
        End With

Second part:
        rsDefinition.AddNew
        'fill the fields

Third part:
        .ActiveConnection = conRDBMS
        .UpdateBatch

Normally i should have now in that recordset the record with the new PK. Unfortunatelay it doesn't do that.
When i look at some properties of the recordset they say:
"Row handle referred to a deleted row or a row marked for deletion."
Giving error number -2147217885

How do i solve that? Has it something to do with the ODBC driver?

Greetings,

Frank
0
Comment
Question by:FrankStanssens
  • 6
  • 5
  • 3
  • +3
17 Comments
 
LVL 1

Expert Comment

by:COAtheGREAT
Comment Utility
If i remember well Oracle dosn't seport all types of cursors that ADO provides, and OLEDB is beterr choise.

So you should check if the cursorlocation is clientside for the begining.
0
 
LVL 1

Author Comment

by:FrankStanssens
Comment Utility
I have to use ODBC and cursor location is client side
0
 
LVL 1

Expert Comment

by:COAtheGREAT
Comment Utility
Did you check errors after UpdateBatch, I mean if you have on error resume next or something like that.
0
 
LVL 1

Expert Comment

by:Ryan_231
Comment Utility
0
 
LVL 1

Author Comment

by:FrankStanssens
Comment Utility
yes, i did check them
in my recordset there aren't any records anymore and i need that ID
0
 
LVL 1

Author Comment

by:FrankStanssens
Comment Utility
Ryan,

i saw those articles too but they don't give a solution to my problem

Thanks for your efforts

Frank
0
 
LVL 1

Expert Comment

by:COAtheGREAT
Comment Utility
try .Resync after update
0
 
LVL 1

Author Comment

by:FrankStanssens
Comment Utility
already tried that
doesn't work
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Expert Comment

by:COAtheGREAT
Comment Utility
try
.LockType = adLockOptimistic
0
 
LVL 1

Expert Comment

by:COAtheGREAT
Comment Utility
with .Resync I mean
0
 
LVL 18

Expert Comment

by:mdougan
Comment Utility
Try adOpenDynamic or adOpenKeyset instead of adOpenStatic

Also, after a recordset is opened, as was mentioned, your provider may not support all of the things that you requested.  So, it's helpful to call the Recordset's Supports method to check to see how the cursor was actually opened.

If RS.Supports(adResync) Then MsgBox "Recordset supports resync"
If RS.Supports(adUpdateBatch) Then MsgBox "Recordset supports UpdateBatch"

etc.
0
 
LVL 1

Author Comment

by:FrankStanssens
Comment Utility
it says recordset supports both
0
 
LVL 18

Expert Comment

by:mdougan
Comment Utility
Are you issuing a rsDefinition.Resync adAffectAll after the update?  If not, try that first.  If so, then this
might be the answer:

Unlike the Refresh method, the Resync method does not re-execute the Recordset object's underlying command; new records in the underlying database will not be visible.

Now, they're probably saying that new records inserted by other users wont be visible, but, I suppose that if you inserted records, resynch may not know to "refresh" the new record.

I'd say that you'll need to issue a .Refresh instead of a .Resync if Resync is not working for you.
0
 
LVL 1

Author Comment

by:FrankStanssens
Comment Utility
Refresh isn't a method of the recordset object.
and Resync doesn't work neither
0
 
LVL 18

Accepted Solution

by:
mdougan earned 100 total points
Comment Utility
Sorry, I think I meant ReQuery.  Did you try opening the cursor as a keyset instead of static?
0
 
LVL 16

Expert Comment

by:twalgrave
Comment Utility
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to mdougan
Please leave any comments here within the
next seven days.
0
 

Expert Comment

by:SpideyMod
Comment Utility
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now