Professional Documents
Culture Documents
Topic: ADO. Net Framework
Topic: ADO. Net Framework
Topic: ADO. Net Framework
Net
Framework
ADO. Net-Overview
Microsoft ActiveX Data Objects.Net (ADO.Net) is a model, and a part of the
.Net framework that is used by the .Net applications for retrieving, accessing
and updating data.
ADO.NET provides a bridge between the front end controls and the back
end database.
Applications communicate with a database,
Firstly, to retrieve the data stored there and present it in a user-friendly way
Secondly, to update the database by inserting, modifying and deleting data.
ADO. Net
The following are a few of the .NET applications that use ADO.NET to
connect to a database, execute commands and retrieve data from the
database.
ASP.NET Web Applications
Console Applications
Windows Applications.
ADO. Net Architecture
ADO.NET Classes
Various important classes in the preceding diagram are:
Connection Class
Command Class
DataReader Class
DataAdaptor Class
DataSet.Class
ADO. Net Connection Class
1. Connection Class
In ADO.NET, we use these connection classes to connect to the database.
Syntax:
String constr="server=SYSTEM-NAME; initial catalog=DATABASE-NAME; integrated
security=true”;
SqlConnection conn=new sqlconnection(constr);
ADO. Net Command Class
2. Command Class
The Command class provides methods for storing and executing SQL statements.
The following are the various commands that are executed by the Command Class.
ExecuteReader: Returns data to the client as rows.
Mostly used directly for printing reports and so forth.
ExecuteNonQuery: Executes a command that changes the data in the database, such as an
update, delete, or insert .
This method returns an integer that is the number of rows affected by the query.
ExecuteScalar: This method only returns a single value.
This kind of query returns a count of rows or a calculated value.
Syntax:
Dataset ds=new dataset(da);
da.fill(ds);
Any Question..?