1. What is the namespace in which .NET has the data functionality classes?
.NET provides the following name functionality:-
2. What are the two fundamental objects in ADO.NET?
The two fundamental objects in ADO.NET
3. What is difference between dataset and datareader?
The major difference is that dataset and datareader:-
Dataset can retain content while datareader don’t persist content.
Dataset is a disconnected architecture while datareader is a connected architecture.
Datareader Provides read-only and forward-only access to data.
4. What are the difference between classic ADO and ADO.NET?
Major differences are as follows:-
In classic ADO it had a separate server side and client side cursor which is no longer required in ADO.NET, since it is a disconnected architecture.
It doesn’t support locking
Data are persisted in binary format in classic ADO.
5. What is the use of connection object?
The main use of connection object is that it connects the command object and data.
6. What is the use of dataadapter?
Dataadapter are objects that can connect ot one or more command objects.
• An oleDataAdapter object is used with OLE-DB provider.
• An sglDataAdapter object uses Tabular Data Services.
7. What is Dataset object?
It provides the basis for disconnected storage and manuplates relation 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.
8. What are various in Dataset?
Dataset consist of DataTable object. The DataTable object contains DataRow object and DataColumn objects. They also contain collection of keys, default values and constraints. Finally, each table contain defaultview.
9. How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?
Sql command object is used for providing functionality of executing stored procedures.
10. How can we force the connection object to close after my datareader is closed ?
Executereader command method takes parameter called as CommandBehavior if we specify close connection automatically after the Datareader is close.
pobjDataReader = pobjCommand.ExecuteReader(CommandBehavior.CloseConnection)
11. What are the various methods provided by the dataset object to generate XML?
Various method provided by dataobject to generate XML are as follows:-
12. What is the basic use of “DataView”?
It represents a table or a section of rows based on some criteria. It is mainly used for sorting and finding data in datatable.
13. Explain the methods in DataView?
FindRow:- It takes array of value and “DataRow” collection.
Find:- It takes array of value and return row index.
AddNew:- It adds a new row to the DataView object.
14. How can we load multiple tables in a Dataset?
Below code creates two tables
objCommand.CommandText = “Myfirsttable”
objCommand.CommandText = “Mysecondtable”
15. How can we add relation’s between table in a DataSet?
DataRelation object can be used to develop relation between tables.
Dim objRelation As DataRelation objRelation=New DataRelation(”CustomerAddresses”,objDataSet.Tables(”Customer”).Columns(”Custid”) ,objDataSet.Tables(”Addresses”).Columns(”Custid_fk”)) objDataSet.Relations.Add(objRelation)
16.What is the use of CommandBuilder?
CommandBulider is used to build objects parameters automatically.
Dim pobjCommandBuilder As New OleDbCommandBuilder(pobjDataAdapter) pobjCommandBuilder.DeriveParameters(pobjCommand)
17. How many way are there to implement locking in ADO.NET?
Method “Update” in DataAdapter can be used to handle locking internally.
Locking can be handled on SQL side or ADO.NET side.
18. How can we perform transactions in .NET?
Open a database connection
Use begin Transaction method to begin transaction.
Execute the SQL command
Commit or roll back the transaction
Close the connectivity.
19. What is the difference between Dataset.clone and Dataset.copy?
Dataset.Clone:- It doesn’t copy the data but only the structure
Dataset Copy:- It copies both structure and data
20. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
There two main basic differences between recordset and dataset :-272
With dataset you an retrieve data from two databases like oracle and sql server and merge them in one dataset , with recordset this is not possible
All representation of Dataset is using XML while recordset uses COM.
Recordset can not be transmitted on HTTP while Dataset can be.
21. What is the difference between optimistic and pessimistic locking?
Pessimistic is used when the user want to lock the records so that no one can update data. The user are only allowed to view the data.
In optimistic multiple user can update an view the data
22. Explain the namespace System.Data?
It contains basic objects that is used to access and to store data. Each of these is independent of the type of data source and the way we connect to it.
23. Explain the namespace System.XML?
System.XML Contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.
24. What is the use of command objects?
They are used to connect connection object to Datareader or dataset. objects?
25. What are the methods in Command object?
Methods in command object:-