Link to home
Start Free TrialLog in
Avatar of steverguy
steverguy

asked on

How can I prevent two applications from accessing/updating the same information in a database?

I am working on a VB.Net application that uses the same database as another application (Access 2000).  The problem I am having with my program is occasionally both programs try to access/update the same table(s) at the same time.  Can anyone suggest a way I can prevent that situation from happening in my program?
Avatar of newyuppie
newyuppie
Flag of Ecuador image

the subject of concurrency is very very wide to post in its entirety here. ill provide 2 useful links and maybe you can draw conclusions. or maybe you can try to narrow your question down to a specific technical problem when applying these suggestions.

http://msdn2.microsoft.com/en-US/library/cs6hb8k4.aspx
http://msdn.microsoft.com/msdnmag/issues/04/09/DataPoints/
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=232672&SiteID=1

or search the MSDN for data concurrency
Avatar of theGhost_k8
well newyupie have posted LINKs ...
i thought let me put an idea... ;)
ok here we go...
why not use to IPC(oops !!! how come that comes into picture)

App A                               App B
------------------------------------------
Uz DB            ------>          flag set
finished uz DB ------->        flag unset

now based on flags .. it will access the db.. if SET then wait till it becomes UNSET
wanna learn IPC:- here is the link V.Ezy....  http://www.codeproject.com/Purgatory/KzIPC.asp
i found its the best way to interact betn applications ..
well if you could find any Prog. option other than this WORKING pls post...
 we were using something like  "adopendynamic/ adlockoptimistic".. try that thing.... i dont remember though :))
Avatar of Kinger247
Kinger247

Yes I agree with newyuppie, concurrency/locking is the only way to do this .. or amend the way your program operates.
Setting flags is doomed to fail :(
Avatar of steverguy

ASKER

I have something I want to clarify as far as the locking is concerned.  I have control over only one of the programs that uses the database.  The other program was written and compiled by another company.  Will using lock optimistic or lock pesimistic still be effective if one of those locking methods is being used by only one program?
As far as I know, your application instructs the database to lock in a specific way. So its the database locking the tables not your app.
Thats how I understand it.
Is there some way to detect whether or not the other application has locked a table or record?
ASKER CERTIFIED SOLUTION
Avatar of newyuppie
newyuppie
Flag of Ecuador 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