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

Scavenging, What is scavenging? When server running your ASP.NET applic...

What is scavenging? When server running your ASP.NET application runs low on the memory resources, items are discarded from the cache depending on cache item priority. The Cach

Shadowing, What is shadowing? When 2 elements in a program have similar...

What is shadowing? When 2 elements in a program have similar name, one of them can hide and shadow the one. Therefore in such cases the element which shadowed the main element

Downloadable software for a pc computer and mac, Downloadable software for ...

Downloadable software for a PC computer and Mac Project Description: "The software" can be sold as a downloadable purchase. I must have all copy rights to "the software" when

My homework, how do you do dot net programming

how do you do dot net programming

School management system, Project Description: I need complete school ma...

Project Description: I need complete school management software, where user will get four module for their enquiry, 1> Student management 2> Staff complete payrole system

Live projects, current available topics on computer graphics

current available topics on computer graphics

Calculating the sum of digits - c# program, Calculating the Sum of Digits -...

Calculating the Sum of Digits - C# Program Hi, Can any of you, tell me how can i calculate the sum of digits of a given number?

Types of validation controls in asp.net, How many types of validation contr...

How many types of validation controls are provided by ASP.NET   The six main types of validation controls are as follows:- 1) Required Field Validator: This validator che

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