OK, cool Toulinwoek, now we have a better basis to go from.
ADO.Net builds on the ADO in the sense of relational database functionality and as well as the principles of OOP. One key difference with ADO.Net is that it supports disconnected data processing. Which means you can continue to manipulate the data with out making further connections to the database or keeping an active open connectiong to the database.
Within ADO.Net Class structure there are classes which are
Data Consumer Classes - those classes used for manipulating of the data,
.Net Data Provider Classes - those classes which provide the interface with the database, and provided some data manipulating and retrieving features, and lastly [b]other .Net Framework Classes[b] - which are related to data handling, and are apart of the
System.Data Namespace.
DataSet = an object that can contain data from a set of related tables. It contains those objects which represent components of those tables, such as;
DataRelation (i.e. table relationships),
DataTable (i.e. an object for each table),
DataColumn, and
DataRow.
With in those
.Net Provider Classes I mentioned, are several classes, two of particular interest are:
DataReader Class and
DataAdpater Class. The
DataReader Class provides a quick, forward & read-only access to data. While the
DataAdapter provides the main link between the provider classes and the
consumer class (those the manipulate the data).
DataAdpater Class : SQL, OleDB, Oracle, ODBC, or any other type
it has four
Command objects which are 4 basic SQL type commands;
- SELECT<
- INSERT<
- UPDATE<
- DELETE <
Hence the tie into consumer class from provider class.
Example use:
using System;
using System.Data;
using System.Data.SqlClient;
namespace SQLRelation
{
class DataRelation
{
[STAThread]
static void Main(string[] args)
{
SqlConnection thisConnection = new SqlConnection("Network Library=DBMSSOCN;Data Source=192.168.0.100,1433;database=Northwind;User id=Me;Password=Me;");
thisConnection.Open();
DataSet thisDataSet = new DataSet();
// setup DataAdapter objects for each table and fill the adapter
SqlDataAdapter custAdapter = new SqlDataAdapter("SELECT * FROM Customers", thisConnection);
custAdapter.Fill(thisDataSet, "Customers");
foreach (DataRow custRow in thisDataSet.Tables["Customers"].Rows)
{
Console.WriteLine("Customer ID: " + custRow["CustomerID"] + " Name: " + custRow["CompanyName"]);
}
thisConnection.Close();
}
}
}
I hope this explaination and example provide you some more insight.... if you still have questions feel free to ask.
Happy Coding