Buy Questpond's video subscriptions on
huge discount
.
Online: 1869
Home
Articles
Interviews
Forums
For Beginners
Popular Questions
ITIL Career Advice
PMP Career Advice
Career Advices
Codes
Videos
ASP.NET
ASP.NET MVC
Android Intel XDK
Sql Server
AngularJS
Bootstrap
Backbone.JS
MongoDB
LESS (CSS)
jQuery
WPF
WWF
SSIS
LightSwitch
Tutorials
News
ASP.NET MVC
|
Be Interview Ready
|
Top Performers
|
DNF MVP
|
Top Posts
|
Winners
|
Subscribe
|
Catalogs
Welcome Guest !
Register
Login
Home
>
Interviews
> ADO.NET
ADO.NET Interview Questions and Answers (445) - Page 17
Latest and authentic Interview questions. You can also
post an interview question
and
win monthly prizes
as well as gain community
credit points
.
445 records found.
Post
|
Interview Experiences
|
Interview FAQs
|
Online Interviews
|
Exclusive Questions
Get 650+ Questpond's Interview videos on discount
Loading ...
You add a method that executes an INSERT command to write state information to a database. You put the write code in a TransactionScope using block. You must ensure that if this method throws an exception within the context of an outer, ambient transaction, it does not affect the completion status of the ambient transaction. Your solution should use the fewest system resources. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You use two DataContext instances to retrieve objects from two database tables. After modifying the returned objects, you call the SubmitChanges method on each instance of DataContext. You want changes to both databases to occur in the context of a single distributed transaction. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You are debugging an application that uses transactions to ensure database consistency. You want to log transaction events, such as transaction scope timeouts and rollbacks. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You add the following code to begin a transactional code block: Transaction Scope = new TransactionScope(); You must ensure that the transactional code that follows this block commits or aborts predictably without extra overhead. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You are debugging an issue with an application that uses nested transactions. You notice that the following code executes without throwing an exception: using (TransactionScope scope = new TransactionScope()) { using (SqlConnection connection1 = new SqlConnection(connectString1)) { SqlCommand command1 = new SqlCommand(updateCommandText, connection1); command1.ExecuteNonQuery(); using (SqlConnection connection2 = new SqlConnection(connectString2)) { SqlCommand command2 = new SqlCommand(insertCommandText, connection2); command2.ExecuteNonQuery(); } } scope.Complete(); } However, you notice that the database changes are not persisted. You must ensure that when Complete is called, changes are persisted. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You are debugging an issue with an application that uses nested transactions. The code intermittently throws TransactionAbortedExceptions. You must log information each time a transaction is created, committed, or rolled back for further debugging. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You use a local transaction to execute two SqlCommands, as shown here: using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = connection.CreateCommand(); SqlTransaction transaction = connection.BeginTransaction("SampleTransaction"); try { command.CommandText = updateSQLCommandText; command.ExecuteNonQuery(); command.CommandText = insertSQLCommandText; command.ExecuteNonQuery(); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); } } When you test this code, you find that after adding the transaction code, the first command throws an exception. You must fix the problem and ensure transactional behavior. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
Your application includes the following code: using (TransactionScope scope = new TransactionScope()) { DebitSourceAccount(); CreditTargetAccount(); scope.Complete(); } You find that the code intermittently throws a TransactionAbortedException event when leaving the using block. You must determine the cause of the exception. Which reason should you choose?
NOTE: This is objective type question, Please click question title for correct answer.
You are debugging an issue with the following code: using (TransactionScope scope = new TransactionScope()) { using (SqlConnection connection1 = new SqlConnection(connectString1)) { SqlCommand command1 = new SqlCommand(updateCommandText, connection1); command1.ExecuteNonQuery(); using (SqlConnection connection2 = new SqlConnection(connectString2)) { SqlCommand command2 = new SqlCommand(insertCommandText, connection2); command2.ExecuteNonQuery(); } } scope.Complete(); } You find that under extremely heavy application load, the code intermittently throws a TransactionAbortedException when leaving the outermost using block. Closer investigation shows that ExecuteNonQuery calls do succeed. You must fix the problem. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You are implementing an application that uses LINQ to SQL to update a data source. You add the following code that uses a DataContext named northwindContext: using (TransactionScope ts = new TransactionScope()) { Product prod1 = northwindContext.Products.First(p => p.ProductID == 4); Product prod2 = northwindContext.Products.First(p => p.ProductID == 5); prod1.UnitsInStock -= 3; prod2.UnitsInStock -= 5; northwindContext.SubmitChanges(); } You notice that when this code executes the data source is not updated. You need to fix the problem and ensure that the data source changes execute in the scope of the transaction. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You implement a method that retrieves a LINQ to SQL Product entity and changes its Status property. You need to ensure that the success or failure of the data source update does not affect any ambient transactions. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You implement a method that uses Entity Framework to perform several update operations. You need to ensure that the method executes within the scope of an ambient transaction if an ambient transaction exists. If an ambient transaction does not exist, you need to ensure that the method's update operations execute as a single transaction. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You are implementing an application that uses LINQ to SQL to update a data source. You add the following code that uses a DataContext named northwindContext: using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { Product prod1 = northwindContext.Products.First(p => p.ProductID == 4); Product prod2 = northwindContext.Products.First(p => p.ProductID == 5); prod1.UnitsInStock -= 3; prod2.UnitsInStock -= 5; northwindContext.SubmitChanges(); ts.Complete(); } This method is called by code that creates a transaction scope. You are debugging by stepping through this method. You notice that the data source is not updated after you step over the call to the Complete method. You need to ensure that the data source is updated. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You are implementing a WCF Service method. The method uses Entity Framework to update a Product entity given by a method parameter. You add code to the method to create an ObjectContext. You need to configure the object context to track and manage the given Product entity. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You are implementing a method that uses Entity Framework to insert a Product entity. You add the following code: public void InsertProduct(Product product) { using (AdventureWorksEntities context = new AdventureWorksEntities()) { context.Products.Attach(product); context.SaveChanges(); } } When you execute the code, you find that the product is not inserted. You need to modify the code to ensure that the product is inserted. What should you do ?
NOTE: This is objective type question, Please click question title for correct answer.
You are implementing a method that uses Entity Framework to update a Product entity. You add the following code: public void UpdateProduct(Product product) { using (AdventureWorksEntities context = new AdventureWorksEntities()) { context.Products.Attach(product); context.SaveChanges(); } } When you execute the code, you find that the product is not updated. You need to modify the code to ensure that the product is updated. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You must choose a method to create a new DataRow to add to a DataTable. The DataRow should reference DataColumns defined by the DataTable before it is added to the DataTable. What method should you choose?
NOTE: This is objective type question, Please click question title for correct answer.
You are creating a method to validate column values of a given DataRow. You want to check column values that have been set since an edit operation was started with the DataRow.BeginEdit method. If validation succeeds, your method calls the DataRow.EndEdit method; otherwise, your method calls the DataRow.CancelEdit method. You need to choose a DataRowVersion to access the edited column values to validate. Which DataRowVersion should you choose?
NOTE: This is objective type question, Please click question title for correct answer.
You are creating a smart client application. When the application is offline, it writes changes and additions to a DataSet to a local file. When the application returns online, it retrieves a new DataSet from a DataAdapter. You must merge the newly retrieved DataSet with the persisted DataSet, ensuring that changes to the persisted DataSet are preserved. What should you do?
NOTE: This is objective type question, Please click question title for correct answer.
You are writing a method to do the following: * Add a new row to a DataTable * Set the second column, a column named LastName, to a string named lastName Which code segment should you choose?
NOTE: This is objective type question, Please click question title for correct answer.
1
...
10
11
12
13
14
15
16
17
18
19
20
21
22
23
More ADO.NET Exclusive Interview Questions & Answers here
Found this useful, bookmark this page to the blog or social networking websites.
Bookmark It
Interview Questions and Answers Categories
.NET Certifications
.NET Core
.NET Framework
ADO.NET
AI ML
Android
Angular
AngularJS 1x
Aptitute Test
ASP.NET
ASP.NET AJAX
ASP.NET Core
ASP.NET MVC
ASP.NET Web API
Aurelia
Azure
Best Practices
BizTalk Server
Bootstrap
C#
Cloud
CMS
CSS 3
Data Structures & Algorithms
Design Pattern & Practices
DotNetFunda.Com
Entity Framework
Error and Solution
F#
Function Points (FPA)
HR
HTML 5
IIS
Interview Questions
JavaScript
jQuery
Kinect
LightSwitch
LINQ
Management
Mobile Development
MSBI (SSIS, SSRS, SSAS)
Mule
Networking
News and Community
Node.js
NoSql
OOPS
Oracle
Others
PostgreSQL
PowerShell
Product Reviews
Project Management
Python
QA (Testing)
R Language
Regular Expressions
SEO
SharePoint
SignalR
Silverlight
Sql Server
TypeScript
UML
VB.NET
Visual Studio
WCF
Web Analytics
Web Services, Remoting
Windows 8
Windows Forms
Windows Metro
Windows Phone
WPF
WWF
XML