ado.net introduction
TRANSCRIPT
ADO.NETYogendra Tamang
Introduction
• Data Access and Manipulation Protocol• Disconnected Data Architecture i.e data you work with is just a copy
of data in the actual database.• Objects are found on System.Data.dll
Features
• LINQ• LINQ to DAtaSet• LINQ to SQL
ADO.NET Objects
• The connection objects [SqlConnection Object]• Connection to datasource to read and write data with these objects
• DataAdapter Objects • Provides communication between datasource and dataset
• Command Object• Allows data adapters to read, add, update and delete records in datasource
• DataTable Object• Holds a data table from a datasource [Columns and Rows]
ADO.NET Objects
• Data Reader Objects• Holds read-only, forward only set of data from database.• Fast because only one row of data in a memory at a time.
• Data View Objects • Customized view of single object
• Constraint Object• Allows data adapters to read, add, update and delete records in datasource
• DataTable Object• Holds a data table from a datasource [Columns and Rows]
Data Providers in ADO.NET
• Set of related components that work together to provide data in efficient manner.• Connecting to DB, executing commands and retrieving results
OBJECTS• Connection• Command• DataReader• DataAdapter
DataSet
• In-memory representation of Data• Local copy of relevant portions of Database• Data in DataSet can be manipulated and updated
independent of the database.• Components of DataSet• DataTable• Stores data in table row format[DataRow and DataColumn]• NewRow() method for adding row to DataTable.
• Components of DataSet• DataView
DataReader
• Sequentially read the data from datasource.• Single row of data is loaded to memory at a time.• Commnad Object is used to retrieve data from database using
DataReader.• After Creating Command Object use command.ExecuteReader to
retrieve row of data from the database.• Use Read() method to read row from results of query.• Call Close() method when you finish using DataReader Object.
DataSet Or DataReader ????
DataAdapter