4 avg. rating (80% score) - 1 votes
ADO.Net is one of the data access technology from Microsoft .NET Framework. Using a set of components ADO.Net provides a communication between relational and non-relational systems. It divides the data access from data manipulation into discrete components which can be used individually. One can check the availability of the job across cities including Mumbai, Delhi, Bangalore, Pune and Hyderabad. ADO.Net role consists of handling set of components that programmers used to access data and services using ASP, SQL, HTML. Wisdomjobs has interview questions which are exclusively designed for job seekers to assist them in clearing job interviews. ADO.Net job interview questions and answers are useful for developers and administrators to attend job interviews and get selected for ADO.Net job position.
ADO.NET is a part of the Microsoft .NET Framework. This framework provides the set of classes that deal with data communication between various layers of the software architecture and the database. It provides a continuous access to different data source types such as SQL Server versions 7, 2000, 2005. It also provides connectivity options to data sources through OLE DB and XML. Connectivity may be established with other databases like Oracle, MySQL etc. as well.
ADO.NET has the ability to separate data access mechanisms, data manipulation mechanisms and data connectivity mechanisms.
ADO.NET introduces along with it the disconnected architecture. In a disconnected architecture, data may be stored in a DataSet. It contains providers for connecting to databases, commands for execution and retrieval of results.
The classes for ADO.NET are stored in the DLL System.Data.dll.
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.
The DataSource property and the DataMember property are used to bind a DataGridView control.
You must set the DataSource property and call the DataBind() method.Mention the namespace that is used to include .NET Data Provider for SQL server in .NET code.The System.Data.SqlClient namespace.
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.
DataSet ds=new DataSet();
SqlDataAdapter dap=new SqlDataAdapter(Select * from ,);
SqlDataAdapter dap1=new SqlDataAdapter(Select * from ,);
A Partial class is a class that can be split into two or more classes. This means that a class can be physically separated into other parts of the class within the same namespace. All the parts must use the partial keyword. All the other classes should also have the same access modifier. At the compile time, all the partial classes will be treated as a single class. Let us list some advantages of having partial classes.
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.
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.
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.
The various methods provided by the DataSet object to generate XML are:
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.
The prerequisites for connection pooling are as follows:
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.
AD0.NET consists of two fundamental components:
The data provider contains the Connection, Command, DataReader, and DataAdapter objects.The Connection object provides connectivity to the database. The Command object 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.
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.
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.
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.
The parameters that control most of connection pooling behaviors are as follows:
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.
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.
There are three different layers of ADO.Net:
Following are the Data Providers used in ADO.Net:.
Following are uses of Stored Procedure:
The default timeout of Sqlcommand. CommandTimeout property is 30 Seconds.
There are two classes involved in System.Data.Common Nameapce:
Language Integrated Query or LINQ provides programmers and testers to query data and it uses strongly type’s queries and results.
Typed datasets use explicit names and data types for their members but untyped dataset uses table and columns for their members.
Thread.Abort() function stops the thread execution at any time.
Sort() method of GridViewControl is used to sort the data in a datatable.
DataRelation object is used to add relationship between two or more datatable objects.
ExecuteNonQuery is the best method to get two values from the database.
Following are the classes that are available in System.Data Namespace:
Following are the components of ADO.Net Data provider:
Connection object – Represents connection to the Database
Command object – Used to execute stored procedure and command on Database
ExecuteNonQuery – Executes command but doesn’t return any value
ExecuteScalar – Executes and returns single value
ExecuteReader – Executes and returns result set
DataReader – Forward and read only recordset
DataAdapter – This acts as a bridge between database and a dataset.
OLEDB provider is used to access any database and provides flexibility of changing the database at any time. SQLClient provider is used to access only SQL Server database but it provides excellent performance than OLEDB provider while connecting with SQL Server database.
Following are different execute methods of ADO.Net command object:
ExecuteScalar – Returns single value from the dataset
ExecutenonQuery – Returns resultset from dataset and it has multiple values
ExecuteReader – Forwardonly resultset
ExecuteXMLReader – Build XMLReader object from a SQL Query
DataAdapter is used to retrieve data from a data source .Insertcommand, UpdateCommand and DeleteCommand are the commands object used in DataAdapter to manage update on the database.
There are different methods under SqlCommand and they are:
Cancel – Cancel the query
CreateParameter – returns SQL Parameter
ExecuteNonQuery – Executes and does not return result set
ExecuteReader – executes and returns data in DataReader
ExecuteScalar – Executes and returns single value
ExecuteXmlReader – Executes and return data in XMLDataReader object
ResetCommandTimeout – Reset Timeout property
Dataset.clone object copies structure of the dataset including schemas, relations and constraints. This will not copy data in the table.
Dataset.copy – Copies both structure and data from the table.
Command is used to execute all kind of queries like DML and DDL. DML is nothing but Insert, Update and Delete. DDL are like Create and drop tables.
Command Builder object is used to build and execute DML queries like Create and Drop Tables.
Yes, it is possible to load multiple tables in a single dataset.
OLEDB Provider and ODBC Provider are used to connect to MS Access and Oracle. Oracle Data Provider is also used to connect exclusively for oracle database.
Yes, stored procedures are used in ADO.Net and it can be used for common repetitive functions.
There are various methods of XML dataset object:
GetXml() – Get XML data in a Dataset as a single string.
GetXmlSchema() – Get XSD Schema in a Dataset as a single string.
ReadXml() – Reads XML data from a file.
ReadXmlSchema() – Reads XML schema from a file.
WriteXml() – Writes the contents of Dataset to a file.
WriteXmlSchema() – Writes XSD Schema into a file.
SQL Server should authenticate before performing any activity in the database. There are two types of authentication:
Windows Authentication – Use authentication using Windows domain accounts only.
SQL Server and Windows Authentication Mode – Authentication provided with the combination of both Windows and SQL Server Authentication.
ADO.Net Related Tutorials
|VB.NET Tutorial||C#. NET Tutorial|
|ASP.NET Tutorial||Windows Presentation Foundation(WPF) Tutorial|
ADO.Net Related Interview Questions
|VB.NET Interview Questions||C#. NET Interview Questions|
|ASP.NET Interview Questions||Windows Presentation Foundation(WPF) Interview Questions|
|Windows CE .NET Interview Questions||Dot Net Framework Interview Questions|
|Asp Dot Net Mvc 4 Interview Questions||Asp Dot Net Mvc Interview Questions|
Introducing Web Portals And Dropthings.com
Architecting The Web Portal And Widgets
Building The Web Layer Using Asp.net Ajax
Building The Data And Business Layers Using .net 3.5
Building Client-side Widgets
Optimizing Asp.net Ajax
Creating Asynchronous, Transactional, Cache-friendly Web Services
Improving Server-side Performance And Scalability
Improving Client-side Performance
Solving Common Deployment, Hosting, And Production Challenges
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.