|
Ado.Net is an Object-oriented set of libraries that allows you to interact with data sources. Commonly, the data source is a database, but it could be a text file, an excel spread sheet or an XML file. Here they are lot of database available and .net providers the providers that will help us to communicate with the respective database. The following data providers can be used to connect to a database from ASP.Net applications.
System.Data.SqlClient: Classes that will be used to fetch, update, delete operations on MS Sql Server database.
System.Data.OracleClient: responsible for communicating with Oracle and manipulating data in database
System.Data.Oledb: contains classes for communicating to a data source that has an OLEDB provider such as we are accessing Access database we have to use this provider as the middleware.
System.Data.Odbc: contains classes for communicating to a data source that has an ODBC driver.
Backbones of ADO.Net:
Ado.net includes many objects you can use to manipulate data in the database. Below are the lists of objects that are used when communicating with database.
- SqlConnection: To interact with a database, you must have a connection to it. The connection objects helps identifying the database server, database name, user name and password. The connection object is used by command objects.
- SqlCommand: You can use this object to send SQL statements to the database. This can represent a SQL Statement or stored procedure.
- SqlDataReader: The data reader object allows you to obtain the Results of a Select statement from a command object. The data returned from a data reader is a fast forward-only stream of data. This fetch data in a sequential manner.
- DataSet : You can imagine dataset as a database. This contains multiple datatable objects, which further contains columns and rows objects. We can also define relationship among tables in the dataset. This is disconnected approach.
- SqlDataAdapter: The SqlDataAdapter is used to fill dataset object when reading the data and writes in a single batch when persisting changes back to the database. A data adapter contains a reference to the connection object and opens and closes the connection automatically when reading from or writing to the data base. The data adapter contains 4 command objects i.e. SELECT, UPDATE, DELETE, and INSERT.
|