Monday, 25 February 2013

ADO.NET Interview Questions2


ADO.Net Interview Question and Answers



25.
What is the difference between OLEDB Provider and SqlClient ?

SQLClient .NET classes are highly optimized for the .net / sqlserver combination and achieve optimal results. The SqlClient data provider is fast. It's faster than the Oracle provider, and faster than accessing database via the OleDb layer.

26.
What is the use of Parameter Object?

In ADO Parameter object provides information about a single parameter used in a stored procedure or query.

27.
What is DataAdapter?

DataSet contains the data from the DataAdapter which is the bridge between the DataSet and Database. DataAdapter provides the way to retrieve and save data between the DataSet and Database. It accomplishes this by means of request to the SQL Commands made against the database.

28.
What does ADO mean?

ADO stands for ActiceX Data Objects.It was introduced few years ago as a solution to accessing data that can be found in various forms, not only over a LAN but over the internet. It replaced the data access technologies RDO(Remote Data Objects) and DAO (Data Access Objects).

29.
Name some ADO.NET Objects?

§  Connection Object
§  DataReader Object
§  Command Object
§  DataSet Object
§  DataAdapter Object

30.
What is Data Provider?

A set of libraries that is used to communicate with data source. Eg: SQL data provider for SQL, Oracle data provider for Oracle, OLE DB data provider for access, excel or mysql.

31.
What is the DataTableCollection?

An ADO.NET DataSet contains a collection of zero or more tables represented by DataTable objects. The DataTableCollection contains all the DataTable objects in a DataSet.

32.
What are the benefits of ADO.NET?

ADO.NET offers several advantages over previous versions of ADO and over other data access components. These benefits fall into the following categories:
·         Interoperability
·         Maintainability
·         Programmability
·         Performance
·         Scalability

33.
How to creating a SqlConnection Object?

SqlConnection conn = new SqlConnection("Data Source=DatabaseServer;Initial Catalog=Northwind;User ID=YourUserID;Password=YourPassword");

34.
How to creating a SqlCommand Object?

It takes a string parameter that holds the command you want to execute and a reference to a SqlConnection object.
SqlCommand cmd = new SqlCommand("select CategoryName from Categories", conn);

35.
How to load multiple tables into dataset?

SqlDataAdapter da = new SqlDataAdapter("Select * from Id; Select * from Salry", mycon);
da.Fill(ds);
ds.Tables[0].TableName = "Id";
ds.Tables[1].TableName = "Salary";

36.
What is the provider and namespaces being used to access oracle database?

system.data.oledb
37.
What is the difference between SqlCommand and SqlCommandBuilder?

SQLCommand is used to retrieve or update the data from database.
SQLCommandBuilder object is used to build & execute SQL (DML) queries like select insert update& delete.

38.
What is the use of SqlCommandBuilder?

SQL CommandBuilder object is used to build & execute SQL (DML) queries like select insert update& delete.

39.
What are managed providers?

A managed provider is analogous to ODBC driver or OLEDB provider. It performs operation of communicating with the database. ADO.NET currently provides two distinct managed providers. The SQL Server managed provider is used with SQL server and is a very efficient way of communicating with SQL Server. OLEDB managed provider is used to communicate with any OLEDB compliant database like Access or Oracle.

40.
How do I delete a row from a DataTable?

ds.Tables("data_table_name").Rows(i).Delete
dscmd.update(ds,"data_table_name")

41.
What inside in DataSet?

Inside DataSet much like in Database, there are tables, columns, constraints, relationships, views and so forth.

42.
Explain ADO.Net Architecture?

ADO.NET provides the efficient way to manipulate the database. It contains the following major components. 1. DataSet Object 2. Data Providers :
·         Connection Object
·         Command Object
·         DataReader Object
·         DataAdapter Object.
43.
What is the difference between int and int32?

Both are same. System.Int32 is a .NET class. Int is an alias name for System.Int32.

44.
What is the role of the DataReader class in ADO.NET connections?

It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed.

45.
What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?

SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.

46.
What are acid properties?

Ø  Atomicity
Ø  Consistency
Ø  Isolation
Ø  Durability

47.
What is DataRowCollection?

Similar to DataTableCollection, to represent each row in each Table we have DataRowCollection.

48.
What is the use of Ado.net connection?

Establishes a connection to a specific data source.

49.
What are basic methods of Dataadapter?

§  Fill
§  FillSchema
§  Update

50.
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.

51.
What is DataSet Object?

Dataset is a disconnected, in-memory representation of data. It can contain multiple data table from different database.

52.
What is difference between Optimistic and Pessimistic locking?

In Pessimistic locking when user wants to update data it locks the record and till then no one can update data. Other user’s can only view the data when there is pessimistic locking
In Optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency. Record is only locked when updating the record.

53.
What is Execute Non Query?

The ExecuteNonQuery() is one of the most frequently used method in SqlCommand Object, and is used for executing statements that do not return result sets (ie. statements like insert data , update data etc.).

54.
What providers does Ado.net uses?

The .NET Framework provides mainly three data providers, they are Microsoft SQL Server, OLEDB, ODBC.













No comments:

Post a Comment