PDA

Click to See Complete Forum and Search --> : Updating Changes in a DataGrid back to the DB


PhilipG
Jan 20th, 2000, 10:37 AM
I have a DataEnvironment control that creates a DBGrid 6.0 control. The Control is based on an SQL statment that grabs data from a local Access 2000 database.

I've set the Command Object's LockType = adLockOptimistic so that it will support updates to the database. Now, whenever a user retypes in a field, I get the following error - "Error Occurred while trying to update the column value". I have added NO updating code and really don't know what event to add it to if I had any. How can I write a value back to the database after a field looses focus after being changed?

Thanks!

netSurfer
Jan 20th, 2000, 08:58 PM
Doesn't DBrid have a sub called LeaveCell? I'd put it there. I don't use data bound controls, or at least I don't bind them. I find it much easier to write the database accesses in code then allowing the controls to do it. It takes more code and sometimes may run slower, but I feel like I have better control and the only database activity is what I make. As far as I remember, after binding a control to a database, changing values in that control updates the database automatically. I'm not sure how to stop it from doing this while still binding it.