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 DbDataReaderclass.
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:
- 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 DataSetobject 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 theRejectChanges() 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, theOleDbConnection 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.
AD0.NET consists of two fundamental components:
- The DataSet, which is disconnected from the data source and does not need to know where the data that it holds is retrieved from.
- The .net data provider, which allows you to connect your application to the data source and execute the SQL commands against it.
The data provider contains the Connection, Command, DataReader, and DataAdapterobjects. The Connection object provides connectivity to the database. The Commandobject provides access to database commands to retrieve and manipulate data in a database. The DataReader object retrieves data from the database in the readonly and forward-only mode. The DataAdapter object uses Command objects to execute SQL commands. The DataAdapter object loads the DataSet object with data and also updates changes that you have made to the data in the DataSet object back to the database.
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.
No comments:
Post a Comment