ADO.Net Interview Questions and Answers for Freshers, Experienced

    61 Votes

17) What’s is the use of “DataView” ?

Dataview is used for filtering and sorting data in a datatable.
//Code to sort by employee name in a data table
DataTable Employee = GetTable();
Employee.DefaultView.Sort = "Name";

18) What is the use of dataadapter ?

To populates tables within a dataset from a data source, DataAdapter is used. DataAdapter uses ADO.Net Connection object to connect to a data source. It uses Command Objects like Insertcommand, UpdateCommand and DeleteCommand to make changes to a data source.

string Connection = "server=localhost; uid = UserName ; pwd = Password ; database = DemoDB";
SqlConnection conn = new SqlConnection(Connection);
string StrSql = "Select * from Employee_Table";
SqlDataAdapter Adapter = new SqlDataAdapter();
Adapter.SelectCommand = new SqlCommand(StrSql, conn);
DataSet ds = new DataSet("Employees");

// Code to update data in a data source
ds.Tables["Employee_Table"].Rows[0]["Name"] = "Alen";
Adapter.Update(ds, "Employee_Table");

19) What’s difference between “Optimistic” and “Pessimistic” locking ?

Pessimistic locking is used when the user wants to update a record in a database and the user want to prevent other users from updating the same record. Other user’s can only view the data when there is pessimistic locking. Optimistic locking is used to improve concurrent operations on a record by allowing multiple users to update the same record. The record is only locked when updating the record. Optimistic locking has been widely used by web developers.

20) What’s difference between Dataset. clone and Dataset. Copy ?

Dataset.Clone only copies the schema of a DataSet object like relations between data tables and constraints. Dataset.Copy copies both the data and structure of a DataSet object.

21) Explain in detail the fundamental of connection pooling ?

Connection pooling is used to reduce the overhead of creating a connection to database. A connection pool will have a predefined number of min and max connections to database which will used by application to execute queries. Once application completes a transaction, connection will be released and connection will go back to connection pool rather than connection getting closed.

What is Maximum Pool Size in ADO.NET Connection String ?

Default max pool size is 100. When an application requests for connection from a pool and if the connections are free, pool will return a free connection. If all the connections are in use and connection pool max size is not reached, pool will create a new connection and send it to the application. When a request for new connection arrives and If the max pool size is reached and all the connections are busy, it will be made to wait till one of the existing connection get released back to pool.

23) How to enable and disable connection pooling ? 

Use Pooling = true in connection string if we want to enable connection pooling. To disable connection pooling set Pooling = false .

24) What is LINQ ?

Language-Integrated Query (LINQ) is one of the advanced featured provided by .Net. LINQ provides native query language for C# and VB.Net to update and retrieve data from different data sources like SQL Server Database,XML etc.

Page 3 of 4

Popular Videos


How to improve your Interview, Salary Negotiation, Communication & Presentation Skills.

Got a tip or Question?
Let us know

Related Articles

C# Interview Questions
.Net Framework Interview Questions and Answers
ASP.Net Interview Questions and Answers
ASP.Net MVC Interview questions and Answers
WCF Interview Questions and Answers
ASP.Net Web API Interview Questions
Top 50 Entity framework interview questions & answers