Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database for Shared Access 2

Status
Not open for further replies.

vikramonline

Programmer
Oct 14, 2003
186
IN
I am using Vb/Access to create a multi user application.
How can I program the database for shared access.
I mean how can I restrict one user to access a record when other user is already modifying that.

Does Passmistic Locking help.

Please suggest
 
I think what you are wanting to do is lock a particular record to ensure data integrity. Check out this article from Microsoft website...Has a decent example program attached.


Be careful with the implementation of rowlevel locking. If used incorrectly, it can greatly hender a databases performace especially in a mult-user environment.

Best of Luck
 
Thanx a lot Miners47 ,

I will check the stuff as soon as I get some time.
I know that row level locking can minimize the database performance to an extent in a multi user environment.

So what are the other solution that can be used to counter such problem.
 
I guess it would depend upon how dynamic the data is the users will be accessing. And, how often the users need to see "real time" data.

Could you give some more information about the environment this application will be in?

 
Actually I am creating two applications simultaneoulsy.
Both ar different from each other . I mean no relation.

One is a multi user application created in VB/Access where multiple (3-4) users will access the same database.

Another is Web Based application created in ASP/Access.

In both the application I need to have some mechanism of locking.
 
Is there any other way of creating an VB application for shared database access.
 
Hope someone comes back, as I want to know how one can avoid a multiuser crash when they try to write/update the same record in a table. Again only 4-5 users. I have read variuos articles but all leave me in a quandry. The way it seems is you let it happen to see if an error is produced and then deal with that error. Be good if there was a strightforward error example floating to the surface. Anyone?
 
Hey Guys,

Please help me I am not able to find a soluton to this problem.

 
Did you check out the MS Document Miners47 highlighted.
I must admit it seems a bit bleak on getting assurances on best ways to deal with this. I am /have the same worries as you do. I read various articles that say you should deal with errors after an error has occured rather than predict them and write error handling. That seems difficult to believe. As all my record updating/adding is done in subs I am going to try the following and see if it works. The idea is having a blank field in each row which leaves a flag when someone is working on that record. When they finish they clear the flag. As users are working with recordsets and not keeping the database open for long periods, I'm going to gamble the chances of both users firing the Update command may me a chance in a million. However its still a gamble. Anyone else got a brainwave for us. Thanks
 

You can always check the editmode property

[tt]
EditMode Property (ADO)


Indicates the editing status of the current record.

Return Value

Returns one of the following EditModeEnum values.

Constant Description
adEditNone Indicates that no editing operation is in progress.
adEditInProgress Indicates that data in the current record has been modified but not yet saved.
adEditAdd Indicates that the AddNew method has been invoked, and the current record in the copy buffer is a new record that hasn't been saved in the database.
adEditDelete Indicates that the current record has been deleted.


Remarks

ADO maintains an editing buffer associated with the current record. This property indicates whether changes have been made to this buffer, or whether a new record has been created. Use the EditMode property to determine the editing status of the current record. You can test for pending changes if an editing process has been interrupted and determine whether you need to use the Update or CancelUpdate method.

See the AddNew method for a more detailed description of the EditMode property under different editing conditions.
[/tt]

Good Luck

 
Thanks vb5Prgrmr, thats worth following up, could be very useful. Well deserved star.Thanks again
 
Don't know whats happening around here. Trie to mark 2 postings with a star, didn't work???
 

Perhaps they have made it a single click event with no popup window.?

Thanks

 
It did work some while later when I tried it. Maybe its like me and doesn't always want to work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top