ADO.Net Introduction
ADO.NET is a object library under . Net Framework. ADO.NET help to interact with different data source and different type of Database. The main feature of ADO.NET is disconnected in nature and hold data in XML format. As disconnected in nature , it is faster than ADODB/DAO/RDO. When a client request for a data, ADO.NET read the data from the database and release the database, the data is supplied to the client . The database have no overburden as there is no connection established buy ADO.NET, database is completely free. This makes a database performance faster and deliver huge operation continuously.
ADO.NET follow a common way to interact with the database. Different kind of database can be handle buy it. Other than SQL server, Access , Oracle, text file, Excel file also be handled by ADO.NET . Data provider are the class to interact with different kind of database. Below is the list of some commonly used to provide.
To work with data, ADO.NET has several object . Data Provider object ,DataSet object , Connection object , Command object , DataReader object .
Data Provider object : Data Provider is responsible for connect database and firing SQL command to retrieve the record. Recorded retrieve by data provider is transferred to either DataSet or DataReader.
DataSet object : Data retrieve by Data provider store in DataSet in a form of tables collections. Data store in DataSet is in XML format. DataSet not only Store data, it also store the schema object ,called data relation object. DataSet contain Collection of Data Relation object in it . Tables and foreign keys relationship are stored in this objects.DataSet comes under the namespace System.Data.
Connection object : Connection object is responsible for connecting database. Identifying database server name, user ID, password and also physical file is connected. There are several connection classes in.Net framework. For SQL server it is SQL connection object comes under Sysrem.Data.SqlClient. For Oledb , connections object comes under Sytem.Data.Oledb. Below are the example.
conn = @"provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath+ ";Extended Properties='Excel 8.0;HRD=Yes;IMEX=1';";
"Data Source= Server IP; initial catalog=Your Server Name;Connect Timeout=6000; User ID=User id;Password=Password;"
Command object :Command is the object in ADO.NET to execute an SQL in the database. The command used for data manipulation for insert /update / delete or fetch operation. A comment object can be execute in a database directly or it can be through DataAdopter . On executing command , if you are executing directly , it will give you the number of rows affected and if you are fetching data and executing through data DataAdopter , DataAdopter later fill the data to the DataSet.
DaraReader object : DataReader is used to read the data. It is connection oriented and forward only. When ExecuteReader command is fired, DataReader get the stream of data to read. More than one set can be read by the DataReader . It is used to read the data only, it cannot manipulate data with the database. For SQL server DataReader comes under the System.Data.SqlClient.SqlDataReader.
DataAdapter Object : DataAdapter do a communication between data source and DataSet. DataAdapter is responsible to fetch data from source and fill it in the DataSet. DataAdapter receive a parameter , connection string , to identify the source database, another parameter command . Command is used for data manipulation in database. Another operation to update DataBase , if any changes made to the DataSet , DataAdapter update original data ( AccesptChanges ) to the database.
ADO.NET is a object library under . Net Framework. ADO.NET help to interact with different data source and different type of Database. The main feature of ADO.NET is disconnected in nature and hold data in XML format. As disconnected in nature , it is faster than ADODB/DAO/RDO. When a client request for a data, ADO.NET read the data from the database and release the database, the data is supplied to the client . The database have no overburden as there is no connection established buy ADO.NET, database is completely free. This makes a database performance faster and deliver huge operation continuously.
ADO.NET follow a common way to interact with the database. Different kind of database can be handle buy it. Other than SQL server, Access , Oracle, text file, Excel file also be handled by ADO.NET . Data provider are the class to interact with different kind of database. Below is the list of some commonly used to provide.
Data Provider | Library | Usage |
---|---|---|
ODBC Data Provider | System.Data.Odbc | ODBC supported older database |
OleDb Data Provider | System.Data.OleDb | Acess ,Execl |
Oracle Data Provider | System.Data.Oracle | Oracle Database |
SQL Data Provider | System.Data.Sql | Microsoft Sql Server |
To work with data, ADO.NET has several object . Data Provider object ,DataSet object , Connection object , Command object , DataReader object .
Data Provider object : Data Provider is responsible for connect database and firing SQL command to retrieve the record. Recorded retrieve by data provider is transferred to either DataSet or DataReader.
DataSet object : Data retrieve by Data provider store in DataSet in a form of tables collections. Data store in DataSet is in XML format. DataSet not only Store data, it also store the schema object ,called data relation object. DataSet contain Collection of Data Relation object in it . Tables and foreign keys relationship are stored in this objects.DataSet comes under the namespace System.Data.
Connection object : Connection object is responsible for connecting database. Identifying database server name, user ID, password and also physical file is connected. There are several connection classes in.Net framework. For SQL server it is SQL connection object comes under Sysrem.Data.SqlClient. For Oledb , connections object comes under Sytem.Data.Oledb. Below are the example.
conn = @"provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath+ ";Extended Properties='Excel 8.0;HRD=Yes;IMEX=1';";
OleDbConnection
con = new
OleDbConnection(conn);
"Data Source= Server IP; initial catalog=Your Server Name;Connect Timeout=6000; User ID=User id;Password=Password;"
SqlConnection
objCN = new
SqlConnection();
Command object :Command is the object in ADO.NET to execute an SQL in the database. The command used for data manipulation for insert /update / delete or fetch operation. A comment object can be execute in a database directly or it can be through DataAdopter . On executing command , if you are executing directly , it will give you the number of rows affected and if you are fetching data and executing through data DataAdopter , DataAdopter later fill the data to the DataSet.
DaraReader object : DataReader is used to read the data. It is connection oriented and forward only. When ExecuteReader command is fired, DataReader get the stream of data to read. More than one set can be read by the DataReader . It is used to read the data only, it cannot manipulate data with the database. For SQL server DataReader comes under the System.Data.SqlClient.SqlDataReader.
DataAdapter Object : DataAdapter do a communication between data source and DataSet. DataAdapter is responsible to fetch data from source and fill it in the DataSet. DataAdapter receive a parameter , connection string , to identify the source database, another parameter command . Command is used for data manipulation in database. Another operation to update DataBase , if any changes made to the DataSet , DataAdapter update original data ( AccesptChanges ) to the database.
No comments:
Post a Comment