ADO.NET



21. What are different types of authentication techniques that are used in connection strings to connect .NET applications with Microsoft SQL Server?  

.NET applications can use two different techniques to authenticate and connect with SQL Server. These techniques are as follows: * The Windows Authentication option * The SQL Server Authentication option


22. What is the difference between the Clone() and Copy() methods of the DataSet class?  

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.


23. What is the use of DataView?  

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.


24. What are the methods of DataView Class ?  

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.



25. Explain in brief DataAdapter class in ADO.NET.  

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.


26. How can you add or remove rows from the DataTable object of DataSet?  

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.


27. What are the parameters that control most of connection pooling behaviors?  

The parameters that control most of connection pooling behaviors are as follows: * Connect Timeout * Max Pool Size * Min Pool Size * Pooling


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

Maximum pool size decides the maximum number of connection objects to be pooled. If the maximum pool size is reached and there is no usable connection available the request is queued until connections are released back in to pool. So it’s always a good habit to call the close or dispose method of the connection as soon as you have finished work with the connection object.


29. How to enable and disable connection pooling?  

For .NET it is enabled by default but if you want to just make sure set Pooling=true in the connection string. To disable connection pooling set Pooling=false in connection string if it is an ADO.NET Connection. If it is an OLEDBConnection object set OLE DB Services=-4 in the connection string.


30. Can you explain the difference between an ADO.NET Dataset and an ADO Record set?  

There two main basic differences between record set and dataset:- • With dataset you an retrieve data from two databases like oracle and sql server and merge them in one dataset , with record set this is not possible • All representation of Dataset is using XML while record set uses COM. • Record set cannot be transmitted on HTTP while Dataset can be.


31. What is basic use of “Data View”?  

“Data View” represents a complete table or can be small section of rows depending on some criteria. It is best used for sorting and finding data with in “data table”. Data view has the following methods:- Find It takes an array of values and returns the index of the row. Find Row This also takes array of values but returns a collection of “Data Row”. If we want to manipulate data of “Data Table” object create “Data View” (Using the “Default View” we can create “Data View” object) of the “Data Table” object and use the following functionalities:- Add New Adds a new row to the “Data View” object. Delete Deletes the specified row from “Data View” object.


32. How can we add/remove row is in “Data Table” object of “Dataset”?  

“Data table” provides “NewRow” method to add new row to “Data Table”. “Data Table” has “DataRowCollection” object that has all rows in a “Data Table” object. Following are the methods provided by “DataRowCollection” object:- Add Adds a new row in Data Table Remove It removes a “Data Row” object from “Data Table” Remove At It removes a “Data Row” object from “Data Table” depending on index position of the “Data Table”.


33. How can we save all data from dataset?  

Dataset has “Accept Changes” method, which commits all the changes since last time “Accept changes” has been executed.


34. What are the various methods provided by the dataset object to generate XML?  

• ReadXML Read’s a XML document in to Dataset. • GetXML This is a function, which returns the string containing XML document. • Writexml This writes a XML data to disk.


35. Which is the best place to store connection string in .NET projects?  

Config files are the best places to store connection strings. If it is a web-based application “Web.config” file will be used and if it is a windows application “App.config” files will be used.


36. What is Dataset object?  

The Dataset provides the basis for disconnected storage and manipulation of relational data. We fill it from a data store, work with it while disconnected from that data store, then reconnect and flush changes back to the data store if required.


37. What is the use of data adapter?  

These objects connect one or more Command objects to a Dataset object. They provide logic that would get data from the data store and populates the tables in the Dataset, or pushes the changes in the Dataset back into the data store. • An OleDbDataAdapter object is used with an OLE-DB provider • A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.


38. What is event bubbling?  

Server controls like Datagrid, DataList, and Repeater can have other child controls inside them. Example DataGrid can have combo box inside datagrid. These child control do not raise there events by themselves, rather they pass the event to the container parent (which can be a datagrid, datalist, repeater), which passed to the page as “ItemCommand” event. As the child control send events to parent it is termed as event bubbling.


39. What is difference between dataset and data reader?  

Following are some major differences between dataset and data reader:-
• Data Reader provides forward-only and read-only access to data, while the Dataset object can hold more than one table (in other words more than one row set) from the same data source as well as the relationships between them.
• Dataset is a disconnected architecture while data reader is connected architecture.
• Dataset can persist contents while data reader cannot persist contents, they are forward only.


40. What are major difference between classic ADO and ADO.NET?  

Following are some major differences between both :-
• In ADO we have recordset and in ADO.NET we have dataset.
• In recordset we can only have one table. If we want to accommodate more than one tables we need to do inner join and fill the recordset. Dataset can have multiple tables.
• All data persist in XML as compared to classic ADO where data persisted in Binary format also.


Java Interview Question

.Net Interview Question

PHP Interview Question

AngularJS Interview Questions