INTRODUCTION:
Commonly used definition for
EVOLUTION:
Let’s step into its evolution. Traditional data processing depends primarily on a connected, two tier model. As of today data processing uses multi-tier architecture so there is a need to switch over to a disconnected approach for better scalability. Today’s web application model uses XML to encode data and HTTP as a medium of communication between tier. So maintaining state between requests is mandatory (connected approach doesn’t require handling state, where connection is open for program’s lifetime.). So
Disconnected data architecture
tight integration with XML
Common data representation
So focal point of this programming model is working with disconnected data.
Imports system. Data (VB)
Using system. Data (C#)
Key components:
Dataset
Data Provider
Dataset handles data access. Data Manipulation is taken care by .Net data provider.
DATASET:
It is an in-memory representation of data. It can be used with multiple and differing data sources such as XML file or
stream, data local to application. Dataset can be used if an application meets any of the following requirements:
Remote data access
Multiple and differing data sources
Cache data local to the application
Provide hierarchical XML view of a relational data
and use XSL, Xpath tools
disconnected data access.
DATA PROVIDER:
Data in data source is retrieved using various components of data provider and provide data to application and update the changes back to data source.
Components of Data Provider
Connection
Command
Data adapter
Data Reader
CONNECTION OBJECT:
It establishes connection to data source. Oledb connection object, Sql Connection object are the two types of connection object.
OLEDB Connection works with almost all data source
SQL Connection Object specifically works with Microsoft SQL Server 7.0 or later.
Properties of Connection Object:
Connection String:
It is a primary property. Connection String provides information like data provider, data source, database name, Integrated Security and so on.
For instance,
Provider=SqlOledb1; Data Source=MySqlServer; Initial Catalog=
Northwind; Integrated Security=SSPI
Integrated Security specifies NT authentication to be used. Instead userid and password attribute can be used which is not a recommended practice since it leads to potential security breach.
State Property:
It provides information about current state of the connection object. State Property value zero specifies connection is closed and 1 indicates connection is open.
COMMAND OBJECT:
Data from data source is obtained by executing commands using command objects.
Property of Command Object:
Command Text Property:
It possess Sql Statement or name of the Stored Procedure to perform the command.
Command Type Property:
It contains stored procedure setting or text setting or table direct. Table Direct returns entire table. This setting applies only to OLEDB .Net Providers.
Command Object provides several execute methods namely execute scalar, execute reader, and execute nonquery method. Let’s have a brief look into its function.
Execute Scalar:
Performs query commands that return a single value. For example, counting the number of records in a table.
Execute Non Query:
Executes the command that returns the number of rows affected by the command.
Execute Reader:
It reads records sequentially from the database.
DATA ADAPTER :
It acts as a bridge between data source and data set to retrieve data and reconciles data back to the database. Oledb data adapter works with Oledb provider. Sql data adapter which is specific to Sql Server is faster than Oledb data adapter because it need not go through Oledb layer.
It exchanges data between single data source and single data table object in the data set. To work with multiple tables in dataset multiple data adapter should be used. To populate a table in dataset, data adapter can be called which execute Sql Statement or Stored Procedure. Data Adapter supports Select Command, Insert Command, Update Command and Delete Command Properties.
DATA READER:
Data Reader can be used to increase the performance of the application which works in read-only, forward-only mode.
CONCLUSION:
In this article we had a walkthrough into various components and features of
No comments:
Post a Comment