Ways to implement locking in ado.net, DOT NET Programming

Assignment Help:

What are the ways to implement locking in ADO.NET?

There are many ways to implement locking using ADO.NET which are shown below:-

1)Whenever we call "Update" method of DataAdapter it handles locking internally.

If the DataSet values are not matching with the current data in Database it raises concurrency exception error. We can easily find this error by using Try..Catch block and raise the appropriate error message to the user.

2)We can also define a Datetime stamp field in the table.When actually you are firing the UPDATE SQL statements compare the current timestamp with one existing in the database. The sample SQL below checks for the timestamp before updating and any mismatch in the timestamp  will not update the records. This is the best method used by industries for locking.

Update table1 set field1=@test where LastTimeStamp=@CurrentTimeStamp

3) We can also check for the original values stored in the SQL SERVER and actual changed values. In stored procedure check before updating that the old data is similar as the current. Fore Example shown below SQL before updating the  field1 we check that is the old field1 value same. If not then someone other has updated and necessary steps has to be taken.

Update table1 set field1=@test where field1 = @oldfield1value


Related Discussions:- Ways to implement locking in ado.net

What is a dynamic update, What is a dynamic update? Dynamic update is a...

What is a dynamic update? Dynamic update is a powerful feature of WF that describes the ability of WF to modify the implementation path of a running workflow. This feature is u

Name the two properties of the gridview control, Name the two properties of...

Name the two properties of the GridView control that have to be specified to turn on sorting and paging. The properties of the GridView control that require to be specified to

Samba pos development customisation english version, Project Description: ...

Project Description: customise samba pos. Just remove samba pos logo and rebrand it. The title in the frame needs to be changed as well as the splash screen at the beginning.

Need mvc coder for xlsx/csv file reader, Xlsx/Csv File Reader Need C# MV...

Xlsx/Csv File Reader Need C# MVC coder that will do the following- Take a filepath for an online xlsx, xls or csv file (must be able to handle each of these formats) as well

Precautions for state server mode working, What are the precautions so that...

What are the precautions so that StateServer Mode work properly? Following are some points to remember so that StateServer Mode works properly:- a) StateServer mode session

Difference between the select clause and selectmany method, What is the dif...

What is the difference between the Select clause and SelectMany() method in LINQ? Both the Select clause and SelectMany() method are used to produce a result value from a sourc

I need a windows sharepoint services or similar solution, I need a Windows ...

I need a Windows SharePoint Services or Similar Solution My company desires a reliable way of managing the documents online for each of its clients. The solution would want t

Ado.net, sir, i just trapped in decryption.....wud u plz help me

sir, i just trapped in decryption.....wud u plz help me

Uml in dot.net programming, Give a small explanation of all Elements in the...

Give a small explanation of all Elements in the diagram. Action State: - This is a type of state that has an internal action and one outgoing event that would do the int

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd