Using Data Adapters ado.net tutorials

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes when to use Data Adapters

The data adapters are bridges between data sets and data sources and without them, a data set can not access any kind of data source, because the data adapters take care of all connection details for the data set, populates it with data, and updates the data source.

It differs from the DataReader, in that the DataReader uses the Connection object to access the data directly, without having to use a DataAdapter. The DataAdapter essentially decouples the DataSet object from the actual source of the data, whereas the DataReader is tightly bound to the data in a read-only fashion.

Dataset, data adapter, and data source interaction (scheme)

data adapter

(Populating a DataSet with a Data Adapter)

    ' declare and initialize the SqlDataAdapter
    Dim adapter As New SqlDataAdapter( _
    "SELECT Username FROM aspnet_Users", connection)

    Dim dataset As New DataSet
    adapter.Fill(dataset)
  


Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.