ADO.NET Flashcards
What is ADO.NET?
ADO.NET is a set of classes (a framework) to interact with data
sources such as databases, XML files, text files or Excel files etc.
What is ADO an acronym for?
ADO is the acronym for ActiveX Data Objects.
What are the two types of connection architectures?
Connected and disconnected.
What is Connected Architecture?
The application remains connected with the database throughout the processing.
What is Disconnected Architecture?
The application automatically connects/disconnects during processing. On the application side, it uses temporary data called a DataSet.
What is a connected environment?
A connected environment is one in which an application is constantly connected to a data source.
What are the advantages of connected environments?
Advantages:
- Data concurrency issues are easily controlled.
– At a time only one user can update the data in database.
- Data is always updated.
Disadvantages:
- A constant network connection is required which may lead to network traffic logging
- Scalability and performance issues in application.
– If more than one user connected to database, query processing may be slow
What is a disconnected environment?
A disconnected environment is one in which a user is not necessarily connected with a database. Connection is required only at the time of retrieval or update and after that connection is closed.
What are the advantages and disadvantages of a disconnected environment?
Advantages:
- Multiple applications can simultaneously interact with the database.
- Improve scalability and performance of applications.
Disadvantages:
- Data is not always updated.
- Data concurrency issues can occur when multiple users are updating the data to the data source.
What are the important classes in ADO.NET?
Connection, Command, DataReader, DateAdapter, DataSet
What is the connection class?
Connection is an object that provides database connectivity and the entry point to a database.
When the connection of an object is instantiated, the constructor takes
a connection string that contains the information about the database
server, server type, database name, connection type, and database
user credentials.
What is the command class?
The Command class provides methods for storing and executing SQL statements and Stored Procedures.
What is the DataReader class?
The DataReader is used to retrieve data.
It is used in conjunction with the Command class to execute an SQL
SELECT statement and then access the returned rows.
What is the DataAdapter class?
This class is used in the Disconnected Model of ADO.NET.
The purpose of the DataAdapter is embedded in its name – it performs the activities necessary to get the data from the data source on the server into the database that’s held in the DataSet.
What are the six steps in the connected model?
- Create the SqlConnection object.
* You’ll need the connection string to create it. - Create the SqlCommand object.
* You need the SQL query in string format.
* And SqlConnection object created in the previous step. - Open the connection.
- Execute the SqlCommand.
- Display the result.
- Close the connection.