Solved

Oracle, RDO Updateable RS and .AddNew

Posted on 1999-01-14
8
199 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Input past end of file vbs script 9 81
VBA: Select SQL query based on a config Sheet v2 11 38
Visual Studio search word table and return Cell index 8 48
Help me. 3 43
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

939 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

10 Experts available now in Live!

Get 1:1 Help Now