Ado Net Interview Questions Kudvenkat

ADO.NET Entity Framework is an open source ORM framework that allows you to query the database in an object-oriented fashion. It works with .NET based application and internally wraps ADO.NET. This article contains most commonly asked interview questions and answers for Entity Framework.

I hope these questions and answers will help you to crack your Entity Framework Interview. These interview Questions have been taken from our new released eBook Entity Framework 6.x Questions and Answers. This book contains more than 110 Entity Framework interview questions.

This eBook has been written to make you confident in Entity Framework with a solid foundation. Also, this will help you to turn your programming into your profession. Its would be equally helpful in your real projects or to crack your Entity Framework Interview.

Question 6: What is SqlCommand Object?

Answer 6: The SqlCommand carries the SQL statement that needs to be executed on the database. SqlCommand carries the command in the CommandText property and this property will be used when the SqlCommand calls any of its execute methods.

  • The Command Object uses the connection object to execute SQL queries.
  • The queries can be in the form of Inline text, Stored Procedures or direct Table access.
  • An important feature of Command object is that it can be used to execute queries and Stored Procedures with Parameters.
  • If a select query is issued, the result set it returns is usually stored in either a DataSet or a DataReader object.
  • The three important methods exposed by the SqlCommand object is shown below:

    ExecuteScalar is useful for returning a single value from the database. For example, using this method we can retrieve a sum of sales made by a specific product, total number of records in the employee table, unique id by supplying filtering conditions and so on. Since this method performs faster we do not need to go for the Reader method just to retrieve a single scalar value.

    ExecuteNonQuery is useful for performing data manipulation on the database. Simply, the ExecuteNonQuery is for executing the DML statements. The return value of the ExecuteNonQuery is an integral value that represents the number of rows affected by the Operation.

    ExecuteReader is used when we need to retrieve rows and columns of data using the SQL select statements. As the data retrieved is a table of data, ExecuteReader returns SqlDataReader. We should iterate through this object to get the required values. See for more detail:

    What are the data providers in ADO.NET framework?

    Below Data Providers are used in ADO.NET framework.

  • .NET Framework Data Provider for SQL Server – A Data provider that provides access to Microsoft SQL Server 7.0 or later version and it uses the System.Data.SqlClient namespace.
  • .NET Framework Data Provider for OLE DB – A Data Provider that provides access to any database exposed by using OLE DB and it uses the System.Data.OleDb namespace.
  • .NET Framework Data Provider for ODBC – A Data Provider that provides access to any databases exposed by using ODBC and It uses the System.Data.Odbc namespace.
  • .NET Framework Data Provider for Oracle – A Data Provider that provides access to Oracle database 8.1.7 or later versions and it uses the System.Data.OracleClient namespace.
  • Datareader is an object of ADO.Net which provides access to data from a specified data source. It consists of classes which sequentially read data from a data source like Oracle, SQL or Access.

    A Dataset is set to be collection of data with a tabular column representation. Each column in the table represents a variable and the row represents to value of a variable. This Dataset object can be obtained from the database values.

    Object pooling is nothing but a repository of the objects in memory which can be used later. This object pooling reduces the load of object creation when it is needed. Whenever there is a need of object, object pool manager will take the request and serve accordingly.

    Connection pooling consists of database connection so that the connection can be used or reused whenever there is request to the database. This pooling technique enhances the performance of executing the database commands. This pooling definitely reduces our time and effort.

    Data view is the representation of data in various formats and it can be requested by the users. Data can be exposed in different sort orders or filter on the user condition with the help of Data view. Data Customization is also possible through Data View.

    Data Adapter is a part of ADO.NET data provider which acts as a communicator between Dataset and the Data source. This Data adapter can perform Select, Insert, Update and Delete operations in the requested data source.

    Why is the Stored Procedure used in ADO.NET?

    The following are some of the reasons why you should use Stored Procedures in ADO.NET:

  • To achieve better results
  • Because of safety concerns
  • Its a whole lot easier to use and keep up with.
  • Network traffic is reduced.
  • The time it takes to carry out the task is shorter.
  • ADO.NET Interview Questions and Answers

    Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *