You develop an enterprise application, called XYZApplication that includes a Windows Form presentation layer, middle-tier components for business logic and data access, and a Microsoft SQL Server database.
You are in the process of creating a middle-tier component that will execute the data access routines in your application. When data is passed to this component, the component will call several SQL Server stored procedures to perform database updates. All of these procedure calls run under the control of a single transaction.
The code for the middle-tier component will implement the following objects:
SqlConnection cn = new SqlConnection();
SqlTransaction tr;
If two users try to update the same data concurrently, inconsistencies such as phantom reads will occur. You must now add code to your component to specify the highest possible level of protection against such inconsistencies.
Which code segment should you use?

You develop an enterprise application, called XYZApplication that includes a Windows Form presentation layer, middle-tier components for business logic and data access, and a Microsoft SQL Server database.
You are in the process of creating a middle-tier component that will execute the data access routines in your application. When data is passed to this component, the component will call several SQL Server stored procedures to perform database updates. All of these procedure calls run under the control of a single transaction.
The code for the middle-tier component will implement the following objects:
SqlConnection cn = new SqlConnection();
SqlTransaction tr;
If two users try to update the same data concurrently, inconsistencies such as phantom reads will occur. You must now add code to your component to specify the highest possible level of protection against such inconsistencies.
Which code segment should you use? Correct Answer tr = cn.BeginTransaction(IsolationLevel.Serializable);

Serializable is the highest isolation transaction level. It provide the highest possible level of protection against concurrent data errors. The correct syntax to begin a transaction with this transaction isolation level is: cn.BeginTransaction(IsolationLevel.Serializable)

Related Questions

You are the administrator of a Windows 2000 Server network that runs in mixed mode. You install a new Windows 2000 Server computer. You create and share a new HP LaserJet 4L printer. Your Windows 2000 Professional client computers can print to the new printer successfully. However, when users try to connect to the printer from Windows NT Workstation 4.0 client computers, they receive the dialog box shown in the exhibit. "The server on which the printer resides does not have a suitable HP LaserJet printer driver installed". You want the printer driver to be installed automatically on the Windows NT Workstation computers. What should you do?
You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4 to create anapplication. The application connects to a Microsoft SQL Server 2008 database. You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedures to return multiple result sets. You need to ensure that the result sets are returned as strongly typed values. What should you do?
In the question below, are given a statement followed by three courses of actions numbered I, II and III. On the basis of the information given, you have to assume everything in the statement to be true, and then decide which of the suggested course of action logically follow (s) for pursuing. Statement: The India Risk Survey 2017 report ranks 'Information & Cyber Insecurity' as the biggest risk facing Indian companies. Indian organizations, both public and private, had witnessed over 27,000 incidents of security threat, from January 2017 till June 2017 alone. Phishing, scanning/probing, website intrusions and defacements, virus/malicious code, ransomware, Denial of Service attacks, and data breaches are some ways in which hackers attack business websites, which can cause operational disruptions and potentially steal sensitive information. Small and medium businesses (SMBs), unfortunately, have been seeing rising incidences of cybercrime. In fact, 70 percent of cyberattacks occur at organizations with lesser than 100 employees  Courses of action: I. Mandate basic security practices and policies for all employees, such as 2-factor authentication, internet use guidelines and create and enforce rules on handling and protecting sensitive data. Conduct frequent training to sensitize employees about opening suspicious emails, encrypting their data, using strong passwords on their devices, installing security apps, and limiting activity over public Wi-Fi. Implement and enforce incident reporting to help ensure that even the smallest breach is report to management as well as the IT teams. II. Basics still matter and are some of the best defenses against viruses, malware, and other online threats. Assess the assets that are most at risk - data, servers, network - and ensure that the systems are updated with the latest security software, web browser, and operating system. Implement firewall security and run antivirus software after each update.  III. Ensure regular backup of all critical data - whether stored in-house or on the cloud. Run scheduled attack drills and stress tests to identify vulnerabilities and ensure that data restoration and business continuity are executed as planned.