Introduction
The ADO.NET Dataset is a memory-resident
representation of data that provides a consistent relational programming model
independent of the data source. The Dataset represents a complete set of data
that includes tables, constraints, and relationships among the tables. Because
the Dataset is independent of the data source, a Dataset can include data local
to the application, and data from multiple data sources. Interaction with
existing data sources is controlled through the Data Adapter.
The Select Command property of the Data Adapter is a Command object that
retrieves data from the data source. The Insert Command, Update Command, and
Delete Command properties of the Data Adapter are Command objects that manage
updates to the data in the data source according to modifications made to the
data in the Dataset.
Example : Simple example of data
adapter.
Code
using
System.Data;
using
System.Data.SqlClient;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1
{
public partial
class Form1 :
Form
{
public Form1()
{
InitializeComponent();
FillData();
}
void FillData()
{
using (SqlConnection
c = new
SqlConnection(
Properties.Settings.Default.DataConnectionString))
{
c.Open();
using (SqlDataAdapter
a = new
SqlDataAdapter("SELECT * FROM EmployeeIDs",
c)
{
DataTable t =
new DataTable();
a.Fill(t);
}
}
}
}
}