0% found this document useful (0 votes)
8 views

Ado.net Answer

Uploaded by

dhaygudesuraj261
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Ado.net Answer

Uploaded by

dhaygudesuraj261
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Ado.

net
1. What is Ado.net ?
 Ado.net stands Microsoft ActiveX Data Objects.
 Ado.net is a set classes that can be used to interact with data sources like
database and XML.

2. What are the classes used in Ado.net ?


 SqlConnection
 SqlCommand
 SqlDataReader
 SqlDataAdapter
 Dataset

3. What are the steps to communicate database using Ado.net ?


 Connect to the Database
 Prepare an SQL Command
 Execute the Command
 Retrieve the results and display in the application

4. What is SqlCommand ?
 SqlCommand class is used to prepare an Sql statement or Store Procedure that
we want to execute on Sql server database.
 There are three methods of SqlCommand class which are commonly used :
a) ExecuteScalar : Used when query returns single value.
b) ExecuteReader : Used when query returns more than one value.
c) ExecuteNonScalar : Used when we want to perform an Insert, Update or
Delete operations.

5. What is SqlDataReader ?
 SqlDataReader reads data in the most efficient manner.
 SqlDataReader is connection oriented means it requires an active and open
connection to the data source while reading the data.

6. What is SqlDataAdapter and Dataset?


 SqlDataAdapter and Dataset provides us disconnected data access model.
 Dataset is the collection of datatables and datatable is a collection of datarows.
 Fill() method opens connection to the database, executes Sql command, fills
data in the dataset and closes the connection.

7. What is use SqlBulkCopy class ?


 SqlBulkCopy class is used to copy data from different data source into Sql server
database.
 Using SqlBulkCopy we can load XML data to Sql server.

8. What is Sql injection ?


 Sql injection is an attack where user can inject any script through textbox and
execute those unwanted scripts which harms our database.
 To prevent Sql injection we can use parametrized queries or store procedures.

You might also like