Chapter 5 (Data Access Methods)
Chapter 5 (Data Access Methods)
Chapter 5
Microsoft Data Access Technologies
◼ Over the years Microsoft has introduced an
alphabet soup of database access
technologies.
❑ They have acronyms such as ODBC, OLE DB,
ADO, ADO.NET...
◼ The overall goal is to provide a consistent set
of programming interfaces that can be used
by a wide variety of clients to talk to a wide
variety of data sources, including both
relational and non-relational data.
Data Storage
Data Storage
Unstructured Structured Hierarchical Relational Database
4
ODBC
◼ Microsoft's first initiative in this direction was ODBC, or
Open Database Connectivity.
◼ ODBC provides a C interface to relational databases.
◼ The standard has been widely adopted, and all major
relational databases have provided ODBC drivers.
ODBC Drawback
◼ Slow with large databases: when used with
larger database management systems ODBC
will be slow.
OLE DB
7
ActiveX Data Objects (ADO)
◼ OLE DB was architected for maximum efficiency for C++
programs. Not so with many other languages, such as
Visual Basic.
◼ Therefore to provide an easy to use interface for Visual
Basic Microsoft created ActiveX Data Objects or ADO.
◼ The ADO model has two advantages:
1) It is somewhat easier to use.
9
Where does ADO.net sit?
10
ADO.NET Architecture
11
XML Support
DataSet
DataTable
DataTable
Connection Stored
Procedure
Database
Data Store
DataAdapter
18
Disconnected Data Access Model
19
Disconnected Mode …(2)
◼ In the Disconnected Mode Data Adapter is
used to Open and Close the connection.
◼ All the operations took place in Dataset.
◼ Component mainly used are:
❑ Connection
❑ DataAdapter
❑ DataSet
20
Disconnected Data Access Model
ADO.NET Disconnected mode Example
using System.Windows.Forms;
using System.Data.SqlClient;
namespace ADODisconnectedMode
{
public partial class frmMain : Form
{
public frmMain ()
{
InitializeComponent();
}
namespace ADOConnectedMode
cn.Close();
}}}
Results
Thanks…