Solved

Oracle, RDO Updateable RS and .AddNew

Posted on 1999-01-14
8
203 Views
Last Modified: 2012-05-05
Greetings,
I'm having a little problem with an Updateable  RDO
resultset (rdOpenKeySet, rdrdConcurBatch). My .Update and .BatchUpdate work fine for Updates.
My .AddNew & .Update work fine for Adds but when I try to .BatchUpdate after an .AddNew has occurred I receive the following error:
 
Client Cursor:20 Cannot perform Update with an empty row.

Here is my Add code(the top portion is because there is a join in the rs):

rsPromoCust("TypeID").SourceTable = "TypePromotions"
rsPromoCust("TypeID").KeyColumn = True
rsPromoCust("PromotionID").SourceTable = "TypePromotions"
rsPromoCust("PromotionID").KeyColumn = True
rsPromoCust("DeActivatedOn").SourceTable = "TypePromotions"
rsPromoCust("StartDate").SourceTable = "TypePromotions"
rsPromoCust("EndDate").SourceTable = "TypePromotions"
   
rsPromoCust.AddNew
rsPromoCust("TypeID") = "" & CustDetail & ""
rsPromoCust("PromotionID") = "" & Promo & ""
rsPromoCust("StartDate") = Format(StartDate, "DD-MMM-YY")
rsPromoCust("EndDate") = Format(EndDate, "DD-MMM-YY")
rsPromoCust("TypeID") = "" & CustDetail & ""
rsPromoCust.Update

Any help would be appreciated.

Thanks,
Brad
0
Comment
Question by:bhummel
  • 4
  • 4
8 Comments
 
LVL 10

Accepted Solution

by:
caraf_g earned 150 total points
ID: 1456256
After you've done the .AddNew, you are actually not positioned at the record you've just added. You're not positioned on anything at all.

So you'll have to create a new result set to retrieve the record you've just added so that you can then update it.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1456257
Having said that... why don't you just move the code after the .AddNew to before the .AddNew and leave the .Update out altogether?
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1456258
Or could it be that .Update is actually the wrong method and you intended to do something different? (You are talking about BatchUpdate in your question)
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:bhummel
ID: 1456259
Actually, what I want to do is all of my updates as well as any adds and then use a .BatchUpdate to Commit the changes through a save button or .CancelBatch to cancel all of the changes through a cancel button.

BatchUpdate does this for changes. My problem is with the Add's. Where does the .AddNew place the record in the rs?

Thanks,
Brad
0
 

Author Comment

by:bhummel
ID: 1456260
Actually, what I want to do is all of my updates as well as any adds and then use a .BatchUpdate to Commit the changes through a save button or .CancelBatch to cancel all of the changes through a cancel button.

BatchUpdate does this for changes. My problem is with the Add's. Where does the .AddNew place the record in the rs?

Thanks,
Brad
0
 

Author Comment

by:bhummel
ID: 1456261
Actually, what I want to do is all of my updates as well as any adds and then use a .BatchUpdate to Commit the changes through a save button or .CancelBatch to cancel all of the changes through a cancel button.

BatchUpdate does this for changes. My problem is with the Add's. Where does the .AddNew place the record in the rs?

Thanks,
Brad
0
 

Author Comment

by:bhummel
ID: 1456262
Actually, what I want to do is all of my updates as well as any adds and then use a .BatchUpdate to Commit the changes through a save button or .CancelBatch to cancel all of the changes through a cancel button.

BatchUpdate does this for changes. My problem is with the Add's. Where does the .AddNew place the record in the rs?

Thanks,
Brad
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1456263
.AddNew doesn't place the record in the rs

To retrieve the newly added record in an rs you'll have to re-create an rs
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB 6.0 printer how to align 6 67
How to compare ms sql hashbytes results within vb6 5 84
Help me. 3 60
Child Form in front 4 49
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

829 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