Click to See Complete Forum and Search --> : Locking a Database


Ken_Lee
October 10th, 1999, 09:13 PM
To whom may concern:

I am currently developing a database application and I am now facing quiet a number of problems. But the major one, I would like to consult you all who is expert in Visual Basic

1) The application have a toolbars on the MDI form which consists of New, Edit, Delete, Save. Whenever I click on the edit button, the text boxes from the child form will be enable, which means by default it is disable. How can I detect whether the record have been edited or not. This is because if the user just click the edit button but didn't do any editing and the user again click on the second record, a message will be prompted asking the user to save the data or not. The main point I like to detect whether the record have been edited or not because if the data have not been edited then no record saving process will be done! It will not slow down the performance of the system. I hope that you all get what I mean.

2) The application that I am currently developing is a Client-Server based application using SQL command. This is because with SQL command, we can run it on whatever databases. But the things is how can I lock a database record, any good suggestion or any sites that I can refer.


Thank you


Ken

October 11th, 1999, 02:17 PM
When locking database records you can use lockedit property of a DOA

Michael Nattfalk
October 11th, 1999, 07:45 PM
Hi Ken.

On your first question, regarding changes. Why not use a boolean variable that, when you press edit, becomes FALSE. And then, in the "Change" event of the textboxes involved in the editing, you set this variable to TRUE. Then when you select a new record you first check if the variable is TRUE and then show a message about saving the new information, or if FALSE, display the new record.

Regarding the second question, I believe that the LockEdit property would be the best to use.

regards,
Michael Nattfalk