Link to home
Start Free TrialLog in
Avatar of philhill
philhill

asked on

What is the quickest/easiest way to test if a recordset has been updated, when it is bound to a datagrid.

I have a datagrid that is bound to a recordset.

Before the user hits the save button and I do the updatebatch command on the recordset, they could hit the search button again and refresh the resultset!!!

To prevent this I want to issue an error message if the recordset has been updated but not saved when the search button is pressed.

What is the easiest and neatest way to do this ?

VB6 ADO recordset.
ASKER CERTIFIED SOLUTION
Avatar of RichW
RichW
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richie_Simonetti
Search command moves the current record, ADO does an update every time you edit/add a record and you move to other one.
Avatar of Arana (G.P.)
Arana (G.P.)

what about begintrans and committrans  ?

use commit only in save button , and on search button use
rollback
Avatar of philhill

ASKER

RichW got it half right.
I solved it on my own in the end by checking old and new
values every time the beforecolumn_update method is called
if there was a difference in any of the values I set a boolean flag (datagridupdated = True).  Then when clicking the search button checked this flag a gave a chance to save.  After the search button is clicked always reset the flag to False again.
Thanks, but I would've preferred you gave it to someone else considering you gave me a C.

You changed the event from Click to Beforecolumn_Update, and you changed the type from Long to Boolean.  How is that getting it half right?

You asked for the easiest way to stop users from clicking search more than once, and I gave you an idea for a method to use.





Your answer would have been fine for a single data item in the datagrid, but when you have hundreds of rows and columns its not really practicle to save the values of each and compare them.

Anyway why are you complaining you got the points !!!
Get a life as well.
philhill, please, read guidelines regarding on how to grade an answer. Maybe this time it was not for an "A" but sure it wasn't for a "C". At least, RichW did puts you in right track.
Cheers
Who told you to save the values of each??  I told you to set a variable flag for when you go in, and check the flag each time.  This is essentially what you're doing with the Boolean.  You're checking the flag each time you go in.

Thanks anyway, minus the smart-ass comments.

RichW