ADO.NET Interview Questions & Answers 1.Explain about command builder class feature? A.Implementation of INSERT, DELETE and UPDATE commands is automatic and this class provides the necessary automation. You cannot extend or change the command builder while keeping the base algorithm intact to create action statements.command builder generates the command to generate the command to reflect back the data in database domain from object model(in-memory cache of data).it generates only single table command since the data adapter execute only one sql statement at a time. 2.Explain about ADO.NET and its features? A.ADO.NET features are included in the Microsoft.NET framework. It has software components which help in data access and services. This can be used to make changes to RDBMS and non relational data base systems. This technology is considered to be the forefront of Active X data objects. Ado.net is a set of classes and tools that is build in to the .net framework which provides us powerful,reliable and scalable data driven application.it is used for connection to the several databases like Sql Server,Oracle and MS Access etc. Features: Ado.net provides two types of data providers that are included in its feature which is build in .net framework. the first one is Sql data provider which is used for Sql server 2007 version or later for database connectivity.and second one is OLEDB data provider which is used for oracle,MS Access or etc for database connections. .net data provider having 4 parts-dbconnection,dbcommand,dbDatarReader ,data adapter(insert,update,delete,select). 3.What is the difference between data reader & data set? A.DataReader is connected object and one can process the rows that are returned by query, one at a time. It discards every row after you have gone through it and so it is extremely fast.It contains only read-only data, so no updates are allowed using DataReader objects. In DataReader you can not get the no. of records directly from RecordSet.This is similar to VB 6, ForwardOnly RecordSet. Meanwhile DataSet is disconnected object type.It uses XML to store data Data reader is much faster then dataset if only selection query is their data reader is used for retrieve data from data source but data set is memmory based on representaion of data.it catched set of recored and it is dissconnected environment. 4.Difference between SqlCommand and SqlCommandBuilder? A.SQLCommand is used to retrieve or update the data from database. You can use the SELECT / INSERT,UPDATE,DELETE command with SQLCommand. SQLCommand will execute these commnds in the database. SQLBUILDER is used to build the SQL Command like SELECT/ INSERTR, UPDATE etc. sqlcommand is used to execute query whereas commandbuilder we cannot type the full querye like update,insert it will automatically take the query 5.Explain about Data services? A.ADO.NET has number of combinations of patterns and resources of libraries. This creates a feature which integrates data services with web. It contains formats which represent data such as JSON and plain XML. This form of interaction enables developers to interact with normal http commands. dot net 6.How do different components of ADO.Net interact with each other in disconnected architecture? A.The Data Adapter contains in it the Command and Connection object. It uses the connection object to connect to the database, execute the containing command, fetch the result and update the DataSet. 7.Explain about data provider? A.ADO.NET has two primary parts in its architecture out of which one is data provider. It has its own set of objects and it consists of its own classes. Some of them are connection, parameter, data reader, command and data adapter. This provides access to data sources such as Oracle, SQL server, etc. Data Provider provides access to data source (SQL SERVER , ACCESS ,ORACLE).In short it provides object to achieve functionalities like opening and closing connection , retrieve data and update data. 8.What is ADO.Net? A.database systems to persist, edit or view data. In .Net data access service is provided through ADO.Net (ActiveX Data Object in Dot Net) components. ADO.Net is an object oriented framework that allows you to interact with database systems. We usually interact with database systems through SQL queries or stored procedures. ADO.Net encapsulates our queries and commands to provide a uniform access to various database management systems. http://www.programmersheaven.com/articles/images/faq/image001.gif ADO.Net is a successor of ADO (ActiveX Data Object). The prime features of ADO.Net are its disconnected data access architecture and XML integration. Access Data Object simply stood for "ADO". EXTENSION OF ADO.NET is Activex Data Object . main use of capturing datasource for bridge between the application layer to the database layer. in other words interaction between application to database with proper connection string under configurations ADO.net is a collection of managed provider with communication with data sources. data sources like database,indexing,sqlserver etc. 9.Why can't we use Multiple inheritance and garbage collector paralelly in .net? A.Multiple Inheritance was not allowed in .Net to avoid "Diamond Problem" (Where a class inherits from two classes which are both inherited from a same base class. Then on invoking the base functions the compiler may get confused to call which function). But wht the garbage collector has to do with this is a matter that we need to really look into. I will try to find the answer for this and come back. 10.What is the difference between data reader and data adapter. A.DateReader is an forward only and read only cursor type if you are accessing data through DataRead it shows the data on the web form/control but you can not perform the paging feature on that record(because it's forward only type). Reader is best fit to show the Data (where no need to work on data) DataAdapter is not only connect with the Databse(through Command object) it provide four types of command (InsertCommand, UpdateCommand, DeleteCommand, SelectCommand), It supports to the disconnected Architecture of .NET show we can populate the records to the DataSet. where as Dataadapter is best fit to work on data. the datareader read the data to database and forword mode only and the datadapter transfer data to dabase into dataset and support dml statment 11.what is dataReader and Data adapter? A.DateReader is an forward only and read only cursor type if you are accessing data through DataRead it shows the data on the web form/control but you can not perform the paging feature on that record(because it's forward only type). Reader is best fit to show the Data (where no need to work on data) DataAdapter is not only connect with the Databse(through Command object) it provide four types of command (InsertCommand, UpdateCommand, DeleteCommand, SelectCommand), It supports to the disconnected Architecture of .NET show we can populate the records to the DataSet. where as Dataadapter is best fit to work on data. the datareader read the data to database and forword mode onlyand the datadapter transfer data to dabase into dataset and support dml statment 12.Can we connect two datareader to same data source using single connection at same time? A.Yes, you can connect two datareader to the same datasource, but one mainthing is close the first datareader before using second one then only it's possible. The point is, we can have any number of datareaders to the same datasource, but only one of them could have an active connection at any point of time. 13.What is the Dot Net Framework data provider for Oracle? A.The dot net framework data provider for Oracle is the optimized data provider for Oracle DBMS. It is recommended to use Oracle data provider to access the Oracle DB than general provider like OLEDB. It supports the Oracle Client version 8.1.7 and later. The classes for this provider are present in the System.Data.OracleClient namespace. This provider is included in the .Net framework 1.1 and was not available in the Dot Net framework 1.0. You can, however, download it from the Microsoft web site for the framework 1.0 at System.Data.Oracle; 14.Explain about LINQ? A.Language integrated query or LINQ provides developers to query data. It uses strongly typed queries and results. Developer productivity increases by the usage of compile time error checking and intellisense. This feature is common on number of data types. 15.What is the difference between ADO and ADO.NET? A.ADO is used in windows based application and ADO.NET is used in web based application OR ADO is mainly used for data Access and its an Connection Oriented. where as ADO.Net is also used for Data Access and its an Connectionless Oriented. 16.How many records can take clustured index in sql server? A.THERE CAN BE AT THE MOST 1 CLUSTERED INDEX FOR ONE TABLE IN SQL SERVER You may only have one cluster index per table because it causes the table to be physically re-ordered on the disk. By definition a clustered index physically arranges all data in a table in a sequential manner. Since you can not have more than one physical arrangements of data in a table you can have just one clustered index per table. 17.Explain LINQ to Entities? A.This feature allows LINQ query capabilities and it specifically forms a part of the .NET framework. This feature allows developers to program in ADO.NET and ORM. This feature also allows access to third party database. This provides new features to entity data. 18.What is the Dot Net Framework data provider for SQL Server? A.The dot net framework data provider for SQL Server is the optimized data provider for Microsoft SQL Server 7 or later. It is recommended to use SQL Server data provider to access the SQL Server DB than general provider like OLEDB. The classes for this provider are present in the System.Data.SqlClient namespace.The dot net framework data provider for SQL Server. We can access it using the namespace System.Data.SqlClient. From there we can access the provider classes:- SqlConnection, SqlCommand, SqlParameter, SqlTransaction. SqlDataReader, SqlDataAdapter. 19.What is the advantage of using stored procedure over the SQL queries? A.Writing the SQL statements inside our code is usually not a good idea. In this way you expose your database schema (design) in the code which may be changed. Hence most of the time programmers use stored procedures instead of plain SQL statements. A stored procedure is a precompiled executable object that contains one or more SQL statements. Hence you can replace your complex SQL statements with a single stored procedure. Since, stored procedures are precompiled objects they execute faster at the database server. Most of the time, stored procedures contain more than one command; in this case, the time to pass the individual commands to the database server from the program is saved. The database is issued just one command (to execute the stored procedure) and the DB server executes all the commands and returns the result in the end. Hence, the overall interaction time with the DB server reduces in a great deal. This can result in a huge optimization in case where the DB server is accessed via a slow network. 20.What are the different languages which implement ADO? A.There are several languages which implement ADO technology out of which these are some of the basic they are VB script in ASP, Visual Basic, Delphi, C++, and Microsoft environments. ADO.NET is a new addition to ADO.C# is the main language which use to implemen ado.