SlideShare a Scribd company logo
Connected data classes
   DbConnection
   DbCommand
   DbDataReader
   DbDataAdapter
   DbProviderFactory
   The classes that are responsible for working with the
    database for
    connecting, retrieving, updating, inserting, and
    deleting data are referred to as provider classes in the
    framework.
   The ADO.NET libraries contain provider classes, which
    are classes that you can use to transfer data between a
    data store and the client application.
   The Microsoft .NET Framework contains the following
    data access providers:
   OleDb
   Odbc
   SqlServer
   Oracle
Connected data classes
   To access a data store, you need a valid, open
    connection object.
   The DbConnection class is an abstract class from
    which the provider-specific connection classes
    inherit.
   To create a connection, you must have a valid
    connection string.

DbConnection connection = new SqlConnection();
connection.ConnectionString =
"Server=.;Database=pubs;Trusted_Connection=true";
connection.Open();
//do work here
connection.Close();
Open Database Connectivity (ODBC) is one of the older
technologies that the .NET Framework supports, primarily
because there are still many scenarios in which the .NET
Framework is required to connect to older database
products that have ODBC drivers.
   Driver={Microsoft Text Driver (*.txt; *.csv)};
    DBQ=C:SampleMySampleFolder;

   Driver={Microsoft Access Driver (*.mdb)};
    DBQ=C:CodemySampleFoldernorthwind.mdb

   Driver={Microsoft ODBC for Oracle};
    Server=ORACLE8i7; UID=john; PWD=s3$W%1Xz

   Driver={Microsoft Excel Driver (*.xls)};
    DBQ=C:SamplesMyBook.xls

   DRIVER={SQL Server};
    SERVER=MyServer; UID=AppUserAccount; PWD=Zx%7$ha;
    DATABASE=northwind;
Another common, but older, technology that is
used to access databases is Object Linking and
Embedding for Databases (OLEDB).
This connection string uses the settings stored in the
MyAppData.udl file (the .udl extension stands for universal
data link):

FILE NAME=C:Program FilesMyAppMyAppData.udl

This connection string uses the Jet driver, which is the
Access driver, and opens the demo.mdb database file.

Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:Program FilesmyAppdemo.mdb;
Persist Security Info=False
Connected data classes
Connected data classes
Persist Security Info=False; Integrated Security=SSPI;
database=northwind;

Network Library=DBMSSOCN;
Data Source=192.168.1.5,1433; Initial Catalog=MyDbName;
User ID=myUsername; Password= u$2hJq@1

Data Source=.SQLEXPRESS;
AttachDbFilename=C:MyApplicationPUBS.MDF;
Integrated Security=True; User Instance=True
<connectionStrings>
<add name="PubsData“ providerName="System.Data.SqlClient"
connectionString= "Data Source=.SQLEXPRESS;
AttachDbFilename=|DataDirectory|PUBS.MDF; Integrated
Security=True; User Instance=True"/>
</connectionStrings>

ConnectionStringSettings pubs =
ConfigurationManager.ConnectionStrings["PubsData"];
DbConnection connection = new SqlConnection(pubs.ConnectionString);
   Connection pooling is the process of reusing existing active
    connections instead of creating new connections when a
    request is made to the database.

   It involves the use of a connection manager that is responsible
    for maintaining a list, or pool, of available connections.

   When the connection manager receives a request for a new
    connection, it checks its pool for available connections. If a
    connection is available, it is returned.

   If no connections are available, and the maximum pool size has
    not been reached, a new connection is created and returned.

   If the maximum pool size has been reached, the connection
    request is added to the queue and the next available
    connection is returned, as long as the connection timeout has
    not been reached.
Connection pooling is controlled by parameters
placed into the connection string. The following
is a list of parameters that affect pooling:

   Connection Timeout
   Min Pool Size
   Max Pool Size
   Pooling
   Connection Reset
   Load Balancing Timeout, Connection Lifetime
   Enlist
   The DbCommand object is used to send one or more
    Structured Query Language (SQL) statements to the
    data store.

   The DbCommand can be any of the following types:
   Data Manipulation Language (DML) Commands that
    retrieve, insert, update, or delete data
   Data Definition Language (DDL) Commands that
    create tables or other database objects, or modify the
    database schema
   Data Control Language (DCL) Commands that
    grant, deny, or revoke permissions

More Related Content

PPT
Database programming in vb net
PPT
ASP.NET 09 - ADO.NET
PDF
Visual Basic.Net & Ado.Net
PPT
Database Connection
PPTX
Ado .net
PPT
ADO.NET
PPT
Ado.net
PPT
Ado.net
Database programming in vb net
ASP.NET 09 - ADO.NET
Visual Basic.Net & Ado.Net
Database Connection
Ado .net
ADO.NET
Ado.net
Ado.net

What's hot (20)

PPTX
Ado.net
PPTX
PPSX
ADO.NET
PPT
ADO .Net
PPTX
Chapter 3: ado.net
PPT
ADO CONTROLS - Database usage
PPTX
ADO.NET -database connection
PDF
Ado.Net Architecture
PPTX
ADO.NET by ASP.NET Development Company in india
PPT
Chap14 ado.net
PPT
Introduction to ADO.NET
PPS
Vb.net session 05
PPTX
Ado.Net Tutorial
PPT
Ado.net &amp; data persistence frameworks
PPTX
Ch06 ado.net fundamentals
PPTX
Data base connectivity and flex grid in vb
PPT
For Beginers - ADO.Net
PPTX
Database connectivity to sql server asp.net
PPTX
Ch 7 data binding
Ado.net
ADO.NET
ADO .Net
Chapter 3: ado.net
ADO CONTROLS - Database usage
ADO.NET -database connection
Ado.Net Architecture
ADO.NET by ASP.NET Development Company in india
Chap14 ado.net
Introduction to ADO.NET
Vb.net session 05
Ado.Net Tutorial
Ado.net &amp; data persistence frameworks
Ch06 ado.net fundamentals
Data base connectivity and flex grid in vb
For Beginers - ADO.Net
Database connectivity to sql server asp.net
Ch 7 data binding
Ad

Viewers also liked (19)

PPTX
Chapter 5 notes
PPTX
Working with xml data
PPTX
Come sfruttare la Procedural Content Generation - Presentazione svilupparty 2014
PPTX
Web services
PPTX
Deploying configuring caching
PPTX
Introducing asp
PPTX
Profile
PPTX
Mobile application
PPTX
User controls
PPTX
Programming web application
PPTX
Monitoring, troubleshooting,
PPTX
Custom controls
PPTX
Globalization and accessibility
PPTX
Disconnected data
PPTX
Intelligent exercise selection for posture and health.
PPTX
Chapter 8 notes
Chapter 5 notes
Working with xml data
Come sfruttare la Procedural Content Generation - Presentazione svilupparty 2014
Web services
Deploying configuring caching
Introducing asp
Profile
Mobile application
User controls
Programming web application
Monitoring, troubleshooting,
Custom controls
Globalization and accessibility
Disconnected data
Intelligent exercise selection for posture and health.
Chapter 8 notes
Ad

Similar to Connected data classes (20)

PPT
Chapter 4 event it theory programming.pptx
PPTX
6 database
PPT
Introduction to ado
DOCX
Ado dot net complete meterial (1)
PPT
Introduction to ado.net
PPTX
PPT temp.pptx
PPTX
111111112222223333335555555666Unit-4.pptx
PPT
the .NET Framework. It provides the claf
PPT
Final Database Connectivity in JAVA.ppt
PPT
JDBC.ppt
DOC
PPT
Java Database Connectivity
PPT
Data Access Technologies
PPTX
Ado.net
PPTX
PPTX
PPTX
Is2215 lecture7 lecturer_ado_intro
PPS
Ado.net session05
PDF
PPT
Chapter 4 event it theory programming.pptx
6 database
Introduction to ado
Ado dot net complete meterial (1)
Introduction to ado.net
PPT temp.pptx
111111112222223333335555555666Unit-4.pptx
the .NET Framework. It provides the claf
Final Database Connectivity in JAVA.ppt
JDBC.ppt
Java Database Connectivity
Data Access Technologies
Ado.net
Is2215 lecture7 lecturer_ado_intro
Ado.net session05

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
Teaching material agriculture food technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Cloud computing and distributed systems.
PDF
Review of recent advances in non-invasive hemoglobin estimation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Machine learning based COVID-19 study performance prediction
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Teaching material agriculture food technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Big Data Technologies - Introduction.pptx
Cloud computing and distributed systems.
Review of recent advances in non-invasive hemoglobin estimation
The AUB Centre for AI in Media Proposal.docx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Machine learning based COVID-19 study performance prediction
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation_ Review paper, used for researhc scholars
Programs and apps: productivity, graphics, security and other tools
Network Security Unit 5.pdf for BCA BBA.
Building Integrated photovoltaic BIPV_UPV.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Spectral efficient network and resource selection model in 5G networks
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Dropbox Q2 2025 Financial Results & Investor Presentation

Connected data classes

  • 2. DbConnection  DbCommand  DbDataReader  DbDataAdapter  DbProviderFactory
  • 3. The classes that are responsible for working with the database for connecting, retrieving, updating, inserting, and deleting data are referred to as provider classes in the framework.  The ADO.NET libraries contain provider classes, which are classes that you can use to transfer data between a data store and the client application.  The Microsoft .NET Framework contains the following data access providers:  OleDb  Odbc  SqlServer  Oracle
  • 5. To access a data store, you need a valid, open connection object.  The DbConnection class is an abstract class from which the provider-specific connection classes inherit.  To create a connection, you must have a valid connection string. DbConnection connection = new SqlConnection(); connection.ConnectionString = "Server=.;Database=pubs;Trusted_Connection=true"; connection.Open(); //do work here connection.Close();
  • 6. Open Database Connectivity (ODBC) is one of the older technologies that the .NET Framework supports, primarily because there are still many scenarios in which the .NET Framework is required to connect to older database products that have ODBC drivers.
  • 7. Driver={Microsoft Text Driver (*.txt; *.csv)}; DBQ=C:SampleMySampleFolder;  Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:CodemySampleFoldernorthwind.mdb  Driver={Microsoft ODBC for Oracle}; Server=ORACLE8i7; UID=john; PWD=s3$W%1Xz  Driver={Microsoft Excel Driver (*.xls)}; DBQ=C:SamplesMyBook.xls  DRIVER={SQL Server}; SERVER=MyServer; UID=AppUserAccount; PWD=Zx%7$ha; DATABASE=northwind;
  • 8. Another common, but older, technology that is used to access databases is Object Linking and Embedding for Databases (OLEDB).
  • 9. This connection string uses the settings stored in the MyAppData.udl file (the .udl extension stands for universal data link): FILE NAME=C:Program FilesMyAppMyAppData.udl This connection string uses the Jet driver, which is the Access driver, and opens the demo.mdb database file. Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:Program FilesmyAppdemo.mdb; Persist Security Info=False
  • 12. Persist Security Info=False; Integrated Security=SSPI; database=northwind; Network Library=DBMSSOCN; Data Source=192.168.1.5,1433; Initial Catalog=MyDbName; User ID=myUsername; Password= u$2hJq@1 Data Source=.SQLEXPRESS; AttachDbFilename=C:MyApplicationPUBS.MDF; Integrated Security=True; User Instance=True
  • 13. <connectionStrings> <add name="PubsData“ providerName="System.Data.SqlClient" connectionString= "Data Source=.SQLEXPRESS; AttachDbFilename=|DataDirectory|PUBS.MDF; Integrated Security=True; User Instance=True"/> </connectionStrings> ConnectionStringSettings pubs = ConfigurationManager.ConnectionStrings["PubsData"]; DbConnection connection = new SqlConnection(pubs.ConnectionString);
  • 14. Connection pooling is the process of reusing existing active connections instead of creating new connections when a request is made to the database.  It involves the use of a connection manager that is responsible for maintaining a list, or pool, of available connections.  When the connection manager receives a request for a new connection, it checks its pool for available connections. If a connection is available, it is returned.  If no connections are available, and the maximum pool size has not been reached, a new connection is created and returned.  If the maximum pool size has been reached, the connection request is added to the queue and the next available connection is returned, as long as the connection timeout has not been reached.
  • 15. Connection pooling is controlled by parameters placed into the connection string. The following is a list of parameters that affect pooling:  Connection Timeout  Min Pool Size  Max Pool Size  Pooling  Connection Reset  Load Balancing Timeout, Connection Lifetime  Enlist
  • 16. The DbCommand object is used to send one or more Structured Query Language (SQL) statements to the data store.  The DbCommand can be any of the following types:  Data Manipulation Language (DML) Commands that retrieve, insert, update, or delete data  Data Definition Language (DDL) Commands that create tables or other database objects, or modify the database schema  Data Control Language (DCL) Commands that grant, deny, or revoke permissions