HANDLING DATABASE WITH ADO.NET
Two Ways to Work with Database: From a Programmer’s Perspective 1.
Using the built-in Visual Tools
3.
Using Code
Connections, Data Adapters and Datasets These
are the objects you need to know to work with databases
These
objects make-up the basis of ADO.NET, which is the primary access protocol in VB.NET
1. CONNECTIONS
To work with data, you first connect to a data source to do that , you use a CONNECTION object.
4 type of connection objects SQLConnection – recommended for MS SQL Server 7.0 or hicher OLEDBConnection – recommended for MS SQL Server 6.5 or earlier ODBCConnection OracleConnection – recommended for Oracle data source
2. Adapters After
you have a connecion object for a data source, you create a data adapter to work with that data.
Adapter
is needed because data sets do not maintain any active connection to the database; they are disconnected from the database and connect only as needed.
Why do you need adapter? The
adapter is in-charge of managing your connection to the data source. It is the data adapter that connects you when you need to be connnected.
It
is the place where you store the SQL statement that will be executed on the data in the database.
It
fills your datasets with data
Types of Adapter SQLDataAdapter 2. OLEDBDataAdapter 3. ODBCDataAdapter 4. OracleDataAdapter 1.
3. Datasets When
you have a data adapter object, you can generate a dataset object using the data adapter.
Datasets
are what you actually work with in your code when handling data.
DATASET CONNECTION
Data Relation
ADAPTER
Database
Table
Table
Rows
Rows
Cols
Cols Your Code