How to Control Concurency using Threads in

Good afternoon All

i have an Application in an Multiuser evironment, i have a Concurency Problem. i would like someone to Explain to me how to handle Concurency using thread, i would like to lock the Update Function when one of users is updating the records and unlock it when the process is done . here is an example of my code

Public Function SaveProperties_Lis(ByVal dsDAta As PropDAL.Dssearchlis) As PropDAL.Dssearchlis

Dim ws As PropDAL.Properties

ws = New PropDAL.Properties

'check the Business Rules

'Updating the dataset


Catch ex As Exception
End Try

Return dsDAta

End Function[/code]
i have this Function in BLL(Business Logic Layer). i want to lock it , when another user is using it.
The Bll is running on the Client machine and its a DLL that is deployed with the Application. i need to trap the Concurency situation in the BLL. The code above is retreaving the data from the DAL(data Access Layer), so the BLL will create an object of a DAL and use the DAL functions, and the Client application will call the BLL for service by creating an object of BLL and use the methods of BLL that will use the methods of DAL, i have not prevented Concurency to a database,and thats what i want to do. i want to know how to achieve this in a multi user Environment.



  • In a central place like a global Module...
    Dim g_ThreadLock as new system.threading.mutex

    Where ever you want to lock...


    'do cool stuff here



    end try


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion