Interview Preparation Exam  >  Interview Preparation Notes  >  Placement Papers - Technical & HR Questions  >  ADO.NET (Part - 1), .NET Interview Questions

ADO.NET (Part - 1), .NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation PDF Download

1. What is the full form of ADO?

The full form of ADO is ActiveX Data Object.

 

2. Explain ADO.NET in brief.

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.

3. What are major difference between classic ADO and ADO.NET?

Following are some major differences between both

  • In ADO we have recordset and in ADO.NET we have dataset.
  • In recordset we can only have one table. If we want to accommodate more than one tables. We need to do inner join and fill the recordset. Dataset can have multiple tables.
  • All data persist in XML as compared to classic ADO where data persisted in Binary format also.


4. What are the two fundamental objects in ADO.NET?

DataReader and DataSet are the two fundamental objects in ADO.NET.


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

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.SqlClientnamespace) 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.


6. Which namespaces are required to enable the use of databases in ASP.NET pages?

The following namespaces are required to enable the use of databases in ASP.NET pages:

  • The System.Data namespace.

  • The System.Data.OleDb namespace (to use any data provider, such as Access, Oracle, or SQL)

  • The System.Data.SQLClient namespace (specifically to use SQL as the data provider)


7. Explain the DataAdapter.Update() and DataSet.AcceptChanges() methods.

The DataAdapter.Update() method calls any of the DML statements, such as the UPDATEINSERT, or DELETE statements, as the case may be to update, insert, or delete a row in a DataSet. The DataSet.Acceptchanges() method reflects all the changes made to the row since the last time the AcceptChanges() method was called.


8. What is the meaning of object pooling?

Object pooling is a concept of storing a pool (group) of objects in memory that can be reused later as needed. Whenever, a new object is required to create, an object from the pool can be allocated for this request; thereby, minimizing the object creation. A pool can also refer to a group of connections and threads. Pooling, therefore, helps in minimizing the use of system resources, improves system scalability, and performance.


9. Which properties are used to bind a DataGridView control?

The DataSource property and the DataMember property are used to bind a DataGridView control.


10. What property must be set and what method must be called in your code to bind the data from some data source to the Repeater control?

You must set the DataSource property and call the DataBind() method.


11. Mention the namespace that is used to include .NET Data Provider for SQL server in .NET code.

The System.Data.SqlClient namespace.


12. What is the difference between OLEDB Provider and SqlClient?

With respect to usage, there is no difference between OLEDB Provider and SqlClient. The difference lies in their performance. SqlClient is explicitly used to connect your application to SQL server directly, OLEDB Provider is generic for various databases, such as Oracle and Access including SQL Server.

Therefore, there will be an overhead which leads to performance degradation.


13. Name the two properties of the GridView control that have to be specified to turn on sorting and paging.

The properties of the GridView control that need to be specified to turn on sorting and paging are as follows:

  • The AllowSorting property of the Gridview control indicates whether sorting is enabled or not. You should set the AllowSorting property to True to enable sorting.
  • The AllowPaging property of the Gridview control indicates whether paging is enabled or not. You should set the AllowPaging property to True to enable paging.


14. Mention different types of data providers available in .NET Framework.

  • .NET Framework Data Provider for SQL Server - Provides access to Microsoft SQL Server 7.0 or later version. It uses the System.Data.SqlClient namespace.
  • .NET Framework Data Provider for OLE DB - Provides access to databases exposed by using OLE DB. It uses the System.Data.OleDb namespace.
  • .NET Framework Data Provider for ODBC - Provides access to databases exposed by using ODBC. It uses the System.Data.Odbc namespace.
  • .NET Framework Data Provider for Oracle - Provides access to Oracle database 8.1.7 or later versions. It uses the System.Data.OracleClient namespace.


15. Which architecture does Datasets follow?

Datasets follow the disconnected data architecture.


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

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.


17. What is a DataReader object?

The DataReader object helps in retrieving the data from a database in a forward-only, read-only mode. The base class for all the DataReader objects is the DbDataReader class.

The DataReader object is returned as a result of calling the ExecuteReader() method of the Command object. The DataReader object enables faster retrieval of data from databases and enhances the performance of .NET applications by providing rapid data access speed. However, it is less preferred as compared to the DataAdapter object because the DataReader object needs an Open connection till it completes reading all the rows of the specified table. 

An Open connection to read data from large tables consumes most of the system resources. When multiple client applications simultaneously access a database by using the DataReader object, the performance of data retrieval and other related processes is substantially reduced. In such a case, the database might refuse connections to other .NET applications until other clients free the resources.


18. How can you identify whether or not any changes are made to the DataSet object since it was last loaded?

The DataSet object provides the following two methods to track down the changes: 
If you want to revert all changes since the DataSet object was loaded, use the RejectChanges() method.

  • The GetChanges() method - Returns the DataSet object, which is changed since it was loaded or since the AcceptChanges() method was executed.
  • The HasChanges() method - Indicates if any changes occurred since the DataSet object was loaded or after a call to the AcceptChanges() method was made.

 

19. Which property is used to check whether a DataReader is closed or opened?

The IsClosed property is used to check whether a DataReader is closed or opened. This property returns a true value if a Data Reader is closed, otherwise a false value is returned.


20. Name the method that needs to be invoked on the DataAdapter control to fill the generated DataSetwith data?

The Fill() method is used to fill the dataset with data.


21. What is the use of the Connection object?

The Connection object is used to connect your application to a specific data source by providing the required authentication information in connection string. The connection object is used according to the type of the data source. For example, the OleDbConnection object is used with an OLE-DB provider and the SqlConnectionobject is used with an MS SQL Server.


22. What is the use of the CommandBuilder class?

The CommandBuilder class is used to automatically update a database according to the changes made in a DataSet.

This class automatically registers itself as an event listener to the RowUpdating event. Whenever data inside a row changes, the object of the CommandBuilder class automatically generates an SQL statement and uses the SelectCommand property to commit the changes made in DataSet.

OLEDB provider in .NET Framework has the OleDbCommandBuiider class; whereas, the SQL provider has the SqlCommandBuilder class.

The document ADO.NET (Part - 1), .NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation is a part of the Interview Preparation Course Placement Papers - Technical & HR Questions.
All you need of Interview Preparation at this link: Interview Preparation
85 docs|57 tests

Top Courses for Interview Preparation

Explore Courses for Interview Preparation exam

Top Courses for Interview Preparation

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Summary

,

study material

,

Previous Year Questions with Solutions

,

ADO.NET (Part - 1)

,

practice quizzes

,

Exam

,

shortcuts and tricks

,

Free

,

mock tests for examination

,

video lectures

,

.NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation

,

Viva Questions

,

Sample Paper

,

.NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation

,

past year papers

,

ADO.NET (Part - 1)

,

Semester Notes

,

MCQs

,

pdf

,

.NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation

,

Important questions

,

Objective type Questions

,

ADO.NET (Part - 1)

,

ppt

,

Extra Questions

;