|
-
August 18th, 2005, 04:02 AM
#1
how to stop controls updating database immediately on lost focus?
I use VB6 ADO (dataenvironment, commands object)
In my app to maintain data tables I use several control (textbox, datacombo, ect) with set their datasource and datamember properties properly. On the same datatable maintain form there are two commandbuttons "post" and "cancel". Id like to update database when the user click on "post" button, and he could escape from his chages cliclking on "cancel".
My problem is that these controls immediately post its changes when the focus left them. (They automatically update the phisical database record) so I cant implement my buttons functionality.
Can anybody help me?
-
August 18th, 2005, 05:39 AM
#2
Re: how to stop controls updating database immediately on lost focus?
Have a look at this example
I hope it helps!
Last edited by HanneSThEGreaT; December 19th, 2008 at 02:56 AM.
-
August 18th, 2005, 08:24 AM
#3
Re: how to stop controls updating database immediately on lost focus?
Hi,
why don't you just create an unbound recordset (please do *not* try to use recordset.clone!!), fill it from the database, and when clicking on the post- button save it to the table? You then can do a lot of checks (especially important in mutiuser-environment) before saving. This is - compared to the idea givewn below - a lot of work, but very safe it you want
The other way of handling this is using the locktype = adlockbatchoptimistic property (Check it in the MSDN, it is exactly what You're looking for. But be careful if you're working in multiuser- environment ...
The example given in the code of Hannes is IMHO not very elegant (I recommend not to use the adodc-control at all)(Assumed you are working with a grid you have to switch back to edit-mode after every rowchange) ...
have a nice day
Patzer
_____________________________
Philo will never be forgotten
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|