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 lazy initialization, What is lazy initialization? Lazy initiali...

What is lazy initialization? Lazy initialization is a process by which an object is not initialized until it is first called in your code. The .NET 4.0 introduces a new wrapper

What is the difference between dynamic and var data types, What is the diff...

What is the difference between dynamic and var data types? The difference among the var and dynamic data types is that the var data type is strongly type checked at the compile

Explain the difference between xml and html., Explain the difference betwee...

Explain the difference between XML and HTML. XML explains data while HTML describes how the data should be displayed. Thus, HTML is about displaying information while XML is ab

I need ninjatrader strategy, I need Ninjatrader Strategy Project Descrip...

I need Ninjatrader Strategy Project Description: UI for managing orders, entering trades. This project will probably take several months and I need dedicated resources. Sk

I need a experienced microsoft .net web developer, Experienced Microsoft .N...

Experienced Microsoft .NET web developer The developer must be reliable as well as most of all use best practices for coding as well as application design. a) .NET 3.5 (ideal

What is a class, What is a class? A class describes all the attributes ...

What is a class? A class describes all the attributes of objects, as well as the methods that execute the behaviour of member objects. It is a comprehensive data type, which sh

Steps of acquiring a proxy object in webservice, What are the  steps of a...

What are the  steps of acquiring a proxy object in Webservice? The following steps are required to get a proxy object of a webservice at the client side:- 1.     The Clie

I need automatic rate processing, Project Description: PURPOSE Xconne...

Project Description: PURPOSE Xconnect needs a fully automated system for receiving and processing Terminator cost sheets based on set business principle, convert the accepted

Converting rs. to paisa - c# program, Converting Rs. to Paisa - C# Program ...

Converting Rs. to Paisa - C# Program Need the code of C# Program for Converting Rs. to Paisa.

What is asp.net ajax, What is ASP.NET AJAX? ASP.NET AJAX, mostly called...

What is ASP.NET AJAX? ASP.NET AJAX, mostly called AJAX, is a set of extensions of ASP.NET. It is developed by Microsoft to execute AJAX functionalities in Web applications. ASP

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