Is there a way to lock records and/or files in multi user application, using
C#?
Adrian. 5 3942
Hi,
Depending of what you want to lock you use one or other mechanism, for a
file could be as simple as open it as exclusive.
Don't know what kind of records you mean.
You can use Mutex to generate a lock in the local machine, but if your app
is used in more than one machine it does not work.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Adrian" <00@00.00wrot e in message
news:44******** ************@dr eader2.news.tis cali.nl...
Is there a way to lock records and/or files in multi user application,
using
C#?
Adrian.
Yes .. the filestream class supports these operations .. I would highly
recommend not creating a mutex for every item as ignacio mentions. http://msdn2.microsoft.com/en-us/lib...ream.lock.aspx
note that this lock is a write lock
for locking the entire file it just matters how you open it (whether shared
or unshared) ..
Cheers,
Greg Young
MVP - C# http://codebetter.com/blogs/gregyoung
"Adrian" <00@00.00wrot e in message
news:44******** ************@dr eader2.news.tis cali.nl...
Is there a way to lock records and/or files in multi user application,
using
C#?
Adrian.
Thanks.
So there is no simple locking / unlocking of files.
Supposing file B is being used by several users;
a file A is created when file B is opened.
If another user wants to use file B, when file
A exists, he will be kept waiting in a loop
until file A is deleted when the other user
exits file B.
Is this a feasible solution?
Adrian.
"Greg Young" <dr************ *******@hotmail .comwrote in message
news:ug******** ******@TK2MSFTN GP02.phx.gbl...
Yes .. the filestream class supports these operations .. I would highly
recommend not creating a mutex for every item as ignacio mentions. http://msdn2.microsoft.com/en-us/lib...ream.lock.aspx
note that this lock is a write lock
for locking the entire file it just matters how you open it (whether
shared
or unshared) ..
Cheers,
Greg Young
MVP - C# http://codebetter.com/blogs/gregyoung
"Adrian" <00@00.00wrot e in message
news:44******** ************@dr eader2.news.tis cali.nl...
Is there a way to lock records and/or files in multi user application,
using
C#?
Adrian.
No there is simple locking / unlocking
Just open it as exclusive read (others will get an error trying to open it).
Take a look at FileShare http://msdn2.microsoft.com/en-us/lib...fileshare.aspx. You can
pass this when you open a file.
Cheers,
Greg
"Adrian" <00@00.00wrot e in message
news:44******** ************@dr eader2.news.tis cali.nl...
Thanks.
So there is no simple locking / unlocking of files.
Supposing file B is being used by several users;
a file A is created when file B is opened.
If another user wants to use file B, when file
A exists, he will be kept waiting in a loop
until file A is deleted when the other user
exits file B.
Is this a feasible solution?
Adrian.
"Greg Young" <dr************ *******@hotmail .comwrote in message
news:ug******** ******@TK2MSFTN GP02.phx.gbl...
>Yes .. the filestream class supports these operations .. I would highly recommend not creating a mutex for every item as ignacio mentions. http://msdn2.microsoft.com/en-us/lib...ream.lock.aspx
note that this lock is a write lock
for locking the entire file it just matters how you open it (whether
shared
>or unshared) ..
Cheers,
Greg Young MVP - C# http://codebetter.com/blogs/gregyoung
"Adrian" <00@00.00wrot e in message news:44******* *************@d reader2.news.ti scali.nl...
Is there a way to lock records and/or files in multi user application,
using
C#?
Adrian.
Excellent.
Thank you.
Adrian.
"Greg Young" <dr************ *******@hotmail .comwrote in message
news:eT******** ******@TK2MSFTN GP04.phx.gbl...
No there is simple locking / unlocking
Just open it as exclusive read (others will get an error trying to open
it).
>
Take a look at FileShare http://msdn2.microsoft.com/en-us/lib...fileshare.aspx. You can
pass this when you open a file.
Cheers,
Greg
"Adrian" <00@00.00wrot e in message
news:44******** ************@dr eader2.news.tis cali.nl...
Thanks.
So there is no simple locking / unlocking of files.
Supposing file B is being used by several users;
a file A is created when file B is opened.
If another user wants to use file B, when file
A exists, he will be kept waiting in a loop
until file A is deleted when the other user
exits file B.
Is this a feasible solution?
Adrian.
"Greg Young" <dr************ *******@hotmail .comwrote in message
news:ug******** ******@TK2MSFTN GP02.phx.gbl...
Yes .. the filestream class supports these operations .. I would highly
recommend not creating a mutex for every item as ignacio mentions. http://msdn2.microsoft.com/en-us/lib...ream.lock.aspx
note that this lock is a write lock
for locking the entire file it just matters how you open it (whether
shared
or unshared) ..
Cheers,
Greg Young
MVP - C# http://codebetter.com/blogs/gregyoung
"Adrian" <00@00.00wrot e in message
news:44******** ************@dr eader2.news.tis cali.nl...
Is there a way to lock records and/or files in multi user
application,
using
C#?
Adrian.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Fardude |
last post by:
ACCESS 97, Pessimistic Record Locking!???
Does Access 97 allow record level Pessimistic locking?
In other words, when user A is editing a record (has it locked) and
User B tries to edit it (attempts to lock it), user B will get
an error
saying this record cannot be locked now.
It seems like Access 97 is doing optimistic record level...
|
by: Megan |
last post by:
Hi-
I have a question about the Microsoft Access Record-Locking
Information Icon.
Whenever I, or my friends, open my MS Access database, the Microsoft
Access Record-Locking Information Icon appears. When we close the
Access database, the icon disappears.
However now all of the sudden, the Microsoft Access Record-Locking
|
by: ethanj /personal/ |
last post by:
We are using Access 2000 database, with the following settings.
Tool > Options > Advance >
Default Record Locking = Edited Record
Open databases using record level locking = True
Form property >
RecordLock = Edited Record.
However, the record is still NOT locked. Multiple users can still open
|
by: jv |
last post by:
Hello,
I'm using A2K and am trying to make sure that my program only locks one
record at a time and I don't seem to have any luck getting that to
happen.
In the database options, I've selected "Open Database Using
Record-Level Locking" and the default record lock setting is "Edited
Record". My forms' record lock setting is also "Edited...
|
by: wheel |
last post by:
I have been ok with optimistic locking most of the time but I have a
situation now where there is more of a chance that users could try to
edit a record at the same time. I'd like to use pessimitic locking, but
it's not working quite as I expected. I've read all over, and by now
have posted elsewhere on this subject, and (strangely it would...
| |
by: RayPower |
last post by:
I'm having problem with using DAO recordset to append record into a
table and subsequent code to update other tables in a transaction. The
MDB is Access 2000 with the latest service pack of JET 4. The system is
client/server, multiusers based. The MDBs are using record locking.
Here is part of the code:
Dim wkSpace As Workspace, db As...
|
by: master |
last post by:
Actually, it is not only the record locking, what I need, and nobody seems
to descibe this.
Imagine the following scenario.
There is a database with, say 10000 records with some unvalidated data. And
there is an Intranet ASP.NET application which is an interface to the
database in question... and there are 100 pretty girls eager to......
|
by: Cindy Huyser |
last post by:
I have an Access 2000 database behind a threaded Java application that
that can have have concurrent access to the same table (but not the same
record). The database is set up for shared access with "No locks" as the
default, so that optimistic record locking should take place, and "Open
databases using record-level locking" is selected. Each...
|
by: Paul H |
last post by:
I have an Employees table with the following fields:
EmployeeID SupervisorID
Fred Bob
Bob
John Bob
Mary Bill
Bill
I have created a self join in the relationships window, with
|
by: emanning |
last post by:
Using Access 2003 and using a form that's mostly bound. I need a way
to tell if user-1 is on the record when user-2 tries to open the same
record, w/o waiting for the user-1 to save the record first. The only
way I can think of is by adding a flag to the record and setting it to
true when user-1 opens the record. If user-2 tries to open it,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |