ADODB Recordset - BatchUpdate (1 Viewer)

leannemurphy

New member
Local time
Today, 14:59
Joined
Oct 25, 2022
Messages
14
Hi guys,

I read that you should be able to loop through a client side recordset making changes as needed and then at the end do a batchupdate to send all changes at once to the server... however, I've never been able to get this to work as batchupdate only seems to update the current record and other changes are lost.

I use ADODB recordsets all the time to grab data, use it for whatever, and then close it when finished...

Anyone know why this isn't working for me?

Leanne
 

Minty

AWF VIP
Local time
Today, 14:59
Joined
Jul 26, 2013
Messages
10,371
This will only work if your processing is wrapped in a transaction.
Generally, looping through a recordset is seen as inefficient compared to using an update query, which is intrinsically a batch operation, and can be rolled back easily if wrapped in a transaction.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:59
Joined
May 21, 2018
Messages
8,529
Can you post example code where updatebatch method fails?
 

leannemurphy

New member
Local time
Today, 14:59
Joined
Oct 25, 2022
Messages
14
This will only work if your processing is wrapped in a transaction.
Generally, looping through a recordset is seen as inefficient compared to using an update query, which is intrinsically a batch operation, and can be rolled back easily if wrapped in a transaction.
Hi @Minty,

Yes, if I can do an update query then I do one. But often I need information from the record in order to make a decision.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:59
Joined
Feb 19, 2002
Messages
43,275
Yes, if I can do an update query then I do one. But often I need information from the record in order to make a decision.
Update queries allow joins to other queries????
 

leannemurphy

New member
Local time
Today, 14:59
Joined
Oct 25, 2022
Messages
14
I often prefer to look through some records before I make decisions about what I want to do next. I was asking why the batchupdate doesn't work for me when I use it. Sounds like that's because I need to wrap the code in a transaction. I'm an Access VBA developer, not SQL Server. I've done transactions before but a very long time ago.
 

leannemurphy

New member
Local time
Today, 14:59
Joined
Oct 25, 2022
Messages
14
Thanks Minty. So if I were looping through an ADODB recordset and making changes to it, I could begin the transaction beforehand, make any changes, updatebatch and then Commit the transaction?

Also, on a side note, every time I reply to someone and it quotes them I am told I can't submit my reply due to it being spam like! If I delete their quoted reply then it doesn't!
 

cheekybuddha

AWF VIP
Local time
Today, 14:59
Joined
Jul 21, 2014
Messages
2,280
Also, on a side note, every time I reply to someone and it quotes them I am told I can't submit my reply due to it being spam like! If I delete their quoted reply then it doesn't!
I think that is the site's new AI machine-learning algorithm passing judgement on the quality of people's replies! :ROFLMAO:

(Really, I think you need a minimum number of replies yourself before you can start quoting people)
 

Users who are viewing this thread

Top Bottom