|ADO.NET Interview Questions & Answers - Learning Mode|
MICROSOFT INTERVIEW QUESTIONS
ADO.NET INTERVIEW QUESTIONS QUESTIONS & ANSWERS - LEARNING MODE
ADO.NET Interview Questions & Answers - Learning Mode
ADO.NET provides consistent access to data sources such as Microsoft SQL Server, as well as data sources exposed through OLE DB and XML. Data-sharing consumer applications can use ADO.NET to connect to these data sources and retrieve, manipulate, and update the databases.
|Try ADO.NET Interview Questions & Answers - Exam Mode|
|ADO.NET Interview Questions & Answers - Learning Mode|
|Try ADO.NET Interview Questions & Answers - Exam Mode|
Question: Explain about data provider?
Answer: ADO.NET has two primary parts in its architecture out of which one is data provider. It has its own set of objects and it consists of its own classes. Some of them are connection, parameter, data reader, command and data adapter. This provides access to data sources such as Oracle, SQL server, etc. Source: CoolInterview.com
Question: How do I update a record in the table using ADO.Net dataset?
Answer: Once you have the UpdateCommand prepared in the data adapter, you can update individual records simply by updating the field values in the data table?s rows. The above code demonstrate how we can update the ?lines? field of the third record of the table ?Article?
DataTable dt = ds.Tables["Article"];
dt.Rows["lines"] = 600;
Dim dt = ds.Tables("Article")
dt.Rows(2)("lines") = 700
da.Update(ds, "Ar Source: CoolInterview.com
Question: What is the Dot Net Framework data provider for OLEDB?
Answer: The dot net framework data provider for OLEDB provides connectivity with the OLEDB supported database management systems. It is the recommended middle tier for the SQL Server 6.5 or earlier and Microsoft Access Database. It is a general data provider. You can also use it to connect with the SQL Server or Oracle Database Management Systems. The classes for this provider are present in the System.Data.OleDBClient namespace.
Question: What is the use of dataadapter ?
Answer: 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["Name"] = "Alen";
Adapter. Source: CoolInterview.com
Question: State some of the basic steps required to access and manipulate data?
Answer: Some of the basic steps which should be taken to access and manipulate data are as follows.
* Creating connection object which helps to connect to a database.
* Record set object should be created which facilitates connection to receive data.
* Opening of the connection
* Passing the desired name for your table and performing necessary functions on the fetched data.
* Changes can be done by using the commands update and update batch. Source: CoolInterview.com
Question: What is Maximum Pool Size in ADO.NET Connection String ?
Answer: 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. Source: CoolInterview.com
Question: Explain the three services model (three-tier application).
Answer: Presentation (UI), business (logic and underlying code) and data (from storage or other sources). Source: CoolInterview.com
Question: Explain about the command Data reader?
Answer: This feature should be used when you have a long list of results and you need to process one at a time. It provides only two features which is read and forward only. Records should be accessed sequentially. Previously accessed records cannot be accessed again. Source: CoolInterview.com
Question: Compare and explain about ADO.NET and Visual Stuidio.NET?
Answer: If you are planning to create specialized sub classes of the data set then it is better to use visual studio as it has features supporting database schema. Access can be obtained to each field through strongly types properties. Intellisense is much helpful. Source: CoolInterview.com
Question: What is the Dot Net Framework data provider for Oracle?
Answer: The dot net framework data provider for Oracle is the optimized data provider for Oracle DBMS. It is recommended to use Oracle data provider to access the Oracle DB than general provider like OLEDB. It supports the Oracle Client version 8.1.7 and later. The classes for this provider are present in the System.Data.OracleClient namespace. This provider is included in the .Net framework 1.1 and was not available in the Dot Net framework 1.0. You can, however, download it from the Microsoft web site Source: CoolInterview.com
Question: What are the namespaces used in ADO.NET for data access in ADO.NET?
Answer: Namespaces used to access database are
System.Data ? Contains all generic data access classes
System.Data.Common ? Contains classes which are shared / overridden by data providers
System.Data.OleDb - OLE DB provider classes used to access database such as Oracle, MySQL, SQL Server and MS Access.
System.Data.SqlClient ? Contains classes for SQL Server
System.Data.SqlTypes ? Contains SQL Server data types Source: CoolInterview.com
Question: What is a stored procedure?
Answer: A stored procedure is a precompiled executable object that contains one or more SQL statements. A stored procedure may be written to accept inputs and return output.
Question: Explain Transactions in ADO.Net?
Answer: using System.Data.SqlClient;
string Connection = "server=localhost; uid = UserName ; pwd = Password ; database = DemoDB";
SqlConnection con = new SqlConnection(Connection);
SqlTransaction SqlTx = con.BeginTransaction();
// Execute SQL commands
tx.Commit(); // Commit Transaction
con.Close(); Source: CoolInterview.com
Question: How do I define a data adapter?
Answer: The data adapter stores your command (query) and connection and using these connect to the database when asked, fetch the result of query and store it in the local dataset.
The DataAdapter class (SqlDataAdapter, OracleDataAdapter, OleDbDataAdapter, OdbcDataAdapter) may be instantiated in three ways:
1. by supplying the command string (SQL Select command) and connection string
2. by supplying the command string (SQL Select command) and a connection object
3. by supply Source: CoolInterview.com
Question: Name some of the top level objects which ADO consists?
Answer: Some of the several objects which ADO consists are as follows they are
* Connection object is responsible for creating a connection to the database.
* Record object represents data which is not from the database.
* Parameter object represents a sql parameter
* Stream object is responsible to represent data from a text page or web page. Source: CoolInterview.com
Question: What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
Answer: 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, but it is a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines. Source: CoolInterview.com
Question: What's the difference between accessing data with dataset or data reader?
Answer: The dataset is generally used when you like to employ the disconnected architecture of the ADO.Net. It reads the data into the local memory buffer and perform the data operations (update, insert, delete) locally to this buffer.
The data reader, on the other hand, is directly connected to the database management system. It passes all the queries to the database management system, which executes them and returns the result back to the application.
Since no memory buffer is maintained by the Source: CoolInterview.com
Question: What are the data providers in ADO.NET framework ?
Answer: .NET Framework Data Provider for SQL Server ? For connecting .Net application with SQL Server. Namespace used for SQL Server Connectivity is System.Data.SqlClient namespace.
Data Provider for SQL Server Compact 4.0 - For connecting .Net application with SQL Server Compact 4.0. Namespace used for SQL Server Compact 4.0 Connectivity is System.Data.SqlServerCe
.NET Framework Data Provider for OLE DB ? For connecting .Net application with data sources exposed by OLE. Namespace used for OLE DB Source: CoolInterview.com
Question: On order to get assembly info which namespace we should import?
Answer: System.Reflection Namespace Source: CoolInterview.com
India News Network
Latest 20 Questions
Payment of time- barred debt is:
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal