Searching for "ADO.NET"

Q:

What are the usages of the Command object in ADO.NET?

Answer

The following are the usages of the Command object in AD0.NET:

The Command object in AD0.NET executes a command against the database and retrieves a DataReader or DataSet object.

  =>  It also executes the INSERT, UPDATE, or DELETE command against the database.
  =>  All the command objects are derived from the DbCommand class.
  =>  The command object is represented by two classes: SqlCommand and OleDbCommand.
  =>  The Command object provides three methods to execute commands on the database:
  =>  The ExecuteNonQuery() method executes the commands and does not return any value.
  =>  The ExecuteScalar() method returns a single value from a database query.
  =>  The ExecuteReader() method returns a result set by using the DataReader object.

Report Error

View answer Workspace Report Error Discuss

Subject: .NET

Q:

What are the usages of the Command object in ADO.NET?

Answer

The following are the usages of the Command object in AD0.NET:

The Command object in AD0.NET executes a command against the database and retrieves a DataReader or DataSet object.

  =>  It also executes the INSERT, UPDATE, or DELETE command against the database.
  =>  All the command objects are derived from the DbCommand class.
  =>  The command object is represented by two classes: SqlCommand and OleDbCommand.
  =>  The Command object provides three methods to execute commands on the database:
  =>  The ExecuteNonQuery() method executes the commands and does not return any value.
  =>  The ExecuteScalar() method returns a single value from a database query.
  =>  The ExecuteReader() method returns a result set by using the DataReader object.

Report Error

View answer Workspace Report Error Discuss

Subject: .NET

Q:

What is the role of the DataSet object in ADO.NET?

Answer

One of the major component of ADO.NET is the DataSet object, which always remains disconnected from the database and reduces the load on the database.

Report Error

View answer Workspace Report Error Discuss

Subject: .NET

Q:

What are the benefits of using of ADO.NET in .NET 4.0.

Answer

The following are the benefits of using ADO.NET in .NET 4.0 are as follows:

 =>   Language-Integrated Query (LINQ) - Adds native data-querying capabilities to .NET languages by using a syntax similar to that of SQL. This means that LINQ simplifies querying by eliminating the need to use a separate query language. LINQ is an innovative technology that was introduced in .NET Framework 3.5.
 =>   LINQ to DataSet - Allows you to implement LINQ queries for disconnected data stored in a dataset. LINQ to DataSet enables you to query data that is cached in a DataSet object. DataSet objects allow you to use a copy of the data stored in the tables of a database, without actually getting connected to the database.
=>   LINQ to SQL - Allows you to create queries for data stored in SQL server database in your .NET application. You can use the LINQ to SQL technology to translate a query into a SQL query and then use it to retrieve or manipulate data contained in tables of an SQL Server database. LINQ to SQL supports all the key functions that you like to perform while working with SQL, that is, you can insert, update, and delete information from a table.
=>   SqlClient Support for SQL Server 2008 - Specifies that with the starting of .NET Framework version 3.5 Service Pack (SP) 1, .NET Framework Data Provider for SQL Server (System.Data.SqlClient namespace) includes all the new features that make it fully compatible with SQL Server 2008 Database Engine.
=>   ADO.NET Data Platform - Specifies that with the release of .NET Framework 3.5 Service Pack (SP) 1, an Entity Framework 3.5 was introduced that provides a set of Entity Data Model (EDM) functions. These functions are supported by all the data providers; thereby, reducing the amount of coding and maintenance in your application. In .NET Framework 4.0, many new functions, such as string, aggregate, mathematical, and date/time functions have been added.

Report Error

View answer Workspace Report Error Discuss

Subject: .NET

Q:

Explain ADO.NET in brief.

Answer

ADO.NET is a very important feature of .NET Framework, which is used to work with data that is stored in structured data sources, such as databases and XML files. The following are some of the important features of ADO.NET:

 =>   Contains a number of classes that provide you with various methods and attributes to manage the communication between your application and data source.


 =>   Enables you to access different data sources, such as Microsoft SQL Server, and XML, as per your requirements.


 =>   Provides a rich set of features, such as connection and commands that can be used to develop robust and highly efficient data services in .NET applications.


 =>   Provides various data providers that are specific to databases produced by various vendors. For example, ADO.NET has a separate provider to access data from Oracle databases; whereas, another provider is used to access data from SQL databases.

Report Error

View answer Workspace Report Error Discuss

Subject: .NET

Q:

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You use the ADO.NET Entity Data Model (EDM) to define a Customer entity. You need to add a new Customer to the data store without setting all the customer's properties. What should you do?

A) Call the Create method of the Customer object. B) Call the CreateObject method of the Customer object.
C) Override the Create method for the Customer object. D) Override the SaveChanges method for the Customer object.
 
Answer & Explanation Answer: B) Call the CreateObject method of the Customer object.

Explanation:
Report Error

View Answer Report Error Discuss

Q:

You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4 to create an application. 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?

A) Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function. Use the GetResult B) Apply the FunctionAttribute and ParameterAttribute to the stored procedure function and directly access the strongly typed object from the results collection.
C) Apply the ResultTypeAttribute to the stored procedure function and directly access the strongly typed object from the results collection. D) Apply the ParameterAttribute to the stored procedure function. Use the GetResult
 
Answer & Explanation Answer: A) Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function. Use the GetResult

Explanation:
Report Error

View Answer Report Error Discuss

Q:

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an
application. You use the ADO.NET Entity Framework to model entities. You write the following code segment. (Line numbers are included for reference only.)


01AdventureWorksEntities context = New AdventureWorksEntities
02
03var q = from c in context.Customers
04where c.City == "London"
05orderby c.CompanyName
06select c;


You need to ensure that the application meets the following requirements: "Compares the current values of unmodified properties with values returned from the data source". Marks the property as modified when the properties are not the same. Which code segment should you insert at line 02?

A) context.MergeOption = MergeOption.AppendOnly; B) context.MergeOption = MergeOption.PreserveChanges;
C) context.MergeOption = MergeOption.OverwriteChanges; D) context.MergeOption = MergeOption.NoTracking;
 
Answer & Explanation Answer: B) context.MergeOption = MergeOption.PreserveChanges;

Explanation:
Report Error

View Answer Report Error Discuss