locked
prevent table to update from other user on network RRS feed

  • Pytanie

  • Hi all

    I want to develop application for LAN base. Some time I need to prevent other user to update table 

    thanks

    jasvee

    piątek, 11 września 2020 04:58

Wszystkie odpowiedzi

  • Hi all

    I want to develop application for LAN base. Some time I need to prevent other user to update table 

    thanks

    jasvee

    What you ask for is the very vintage way of pessimistic concurrency error preventing which was working with 4 or 5 users in a network although it was seldom happening. 

    Currently is used optimistic concurrency, it is based on that you save the data before the update and read it just before the update again and then test it before the update. Be aware it has to be done on the Server side and integrated in the Data access provider.

    However, doing what you ask is easy. It is based on the Transaction, which locks everything at the start until an end transaction is given. The backside of it, mostly becomes your database then a mostly closed box. 

    https://docs.microsoft.com/en-us/dotnet/api/system.transactions.transaction?view=netcore-3.1

     


    Success
    Cor

    piątek, 11 września 2020 08:06
  • If you use SQL, then consider DENY and GRANT statements. (In this case you can also visit https://docs.microsoft.com/en-us/answers/products/sql-server).

    Which kind of tables do you have?


    • Zmodyfikowany przez Viorel_MVP piątek, 11 września 2020 08:09
    piątek, 11 września 2020 08:09
  • Hi 

    I am using Ms Access

    thanks

    sobota, 12 września 2020 09:01
  • Hi 

    I am using Ms Access

    thanks

    Maybe, you should consider using an enterprise  level multi user database such as MS SQL Server  Express. Access  may not be a viable database solution.
    sobota, 12 września 2020 09:40
  • Hi 

    I am using Ms Access

    thanks

    If that is the case consider password protecting your database and in app.config encrypt the connection string with the password, see the following class which has this functionality.



    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    sobota, 12 września 2020 11:51