Ado.net


1. What is the full form of ADO?
2. Explain ADO.NET in brief.
3. What are major difference between classic ADO and ADO.NET? 
 4. What are the two fundamental objects in ADO.NET?
5. What are the benefits of using of ADO.NET in .NET 4.0.
6. Which namespaces are required to enable the use of databases in ASP.NET pages
7. Explain the DataAdapter.Update() and DataSetAcceptChanges() method
  8. What is the meaning of object pooling?
9. Which properties 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?
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:
  • 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. 
  • If you want to revert all changes since the DataSet object was loaded, use the RejectChanges() method.
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 DataSet with 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 SqlConnection object 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.
23. Explain the architecture of ADO.NET in brief.
24. Describe the disconnected architecture of ADO.NET's data access model.
ADO.NET maintains a disconnected database access model, which means, the application never remains connected constantly to the data source. Any changes and operations done on the data are saved in a local copy (dataset) that acts as a data source. Whenever, the connection to the server is re-established, these changes are sent back to the server, in which these changes are saved in the actual database or data source.
25. What are the usages of the Command object in ADO.NET?
26. What are the pre-requisites for connection pooling?
The prerequisites for connection pooling are as follows:
  • There must be multiple processes to share the same connection describing the same parameters and security settings.
  • The connection string must be identical.
27. What is connection pooling?
Connection pooling refers to the task of grouping database connections in cache to make them reusable because opening new connections every time to a database is a time-consuming process. Therefore, connection pooling enables you to reuse already existing and active database connections, whenever required, and increasing the performance of your application.

You can enable or disable connection pooling in your application by setting the pooling property to either true or false in connection string. By default, it is enabled in an application.
28. What are the various methods provided by the DataSet object to generate XML?
The various methods provided by the DataSet object to generate XML are:
  • ReadXml() - Reads XML document into a DataSet object.
  • GetXml() - Returns a string containing an XML document.
  • WriteXml() - Writes an XML data to disk.
29. Out of Windows authentication and SQL Server authentication, which authentication technique is considered as a trusted authentication method?
The Windows authentication technique is considered as a trusted authentication method because the username and password are checked with the Windows credentials stored in the Active Directory.

The SQL Server Authentication technique is not trusted as all the values are verified by SQL Server only.
30. How would you connect to a database by using .NET?
The connection class is used to connect a .NET application with a database.
31. Which adapter should you use, if you want to get the data from an Access database?
OleDbDataAdapter is used to get the data from an Access database.
32. Which object is used to add a relationship between two DataTable objects?
The DataRelation object is used to add relationship between two DataTable objects.
33. What are different types of authentication techniques that are used in connection strings to connect .NET applications with Microsoft SQL Server?
.NET applications can use two different techniques to authenticate and connect with SQL Server. These techniques are as follows:
  • The Windows Authentication option
  • The SQL Server Authentication option
34. Explain the new features in ADO.NET Entity Framework 4.0.
35. What is the difference between the Clone() and Copy() methods of the DataSet class?
The Clone() method copies only the structure of a DataSet. The copied structure includes all the relation, constraint, and DataTable schemas used by the DataSet. The Clone() method does not copy the data, which is stored in the DataSet.

The Copy() method copies the structure as well as the data stored in the DataSet.
36. What is the use of DataView?
User-defined view of a table is contained in a DataView. A complete table or a small section of table depending on some criteria can be presented by an object of the DataView class. You can use this class to sort and find data within DataTable.

The DataView class has the following methods:
  • Find() - Finds a row in a DataView by using sort key value.
  • FindRows() - Uses the sort key value to match it with the columns of DataRowView objects. It returns an array of all the corresponding objects of DataRowView whose columns match with the sort key value.
  • AddNew() - Adds a new row to the DataView object.
  • Delete() - Deletes the specified row from the DataView object according to the specified index.
37. What are the parameters that control most of connection pooling behaviors?
The parameters that control most of connection pooling behaviors are as follows:
  • Connect Timeout
  • Max Pool Size
  • Min Pool Size
  • Pooling
38. How can you add or remove rows from the DataTable object of DataSet?
The DataRowCollection class defines the collection of rows for the DataTable object in a DataSet. The DataTable class provides the NewRow() method to add a new DataRow to DataTable. The NewRow method creates a new row, which implements the same schema as applied to the DataTable. The following are the methods provided by the DataRowCollection object:
  • Add() - Adds a new row to DataRowCollection.
  • Remove()- Removes a DataRow object from DataRowCollection.
  • RemoveAt() - Removes a row whose location is specified by an index number.
39. Explain in brief DataAdapter class in ADO.NET.
The DataAdapter class retrieves data from the database, stores data in a dataset, and reflects the changes made in the dataset to the database. The DataAdapter class acts as an intermediary for all the communication between the database and the DataSet object. The DataAdapter Class is used to fill a DataTable or DataSet Object with data from the database using the Fill() method. The DataAdapter class applies the changes made in dataset to the database by calling the Update() method.

The DataAdapter class provides four properties that represent the database command:

SelectCommand, InsertCommand, DeleteCommand, and UpdateCommand.

No comments:

Post a Comment

Popular posts