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

What's hot (20)

PPTX
Ado.net
Om Prakash
 
PPTX
ReactJS
Ram Murat Sharma
 
PPSX
ADO.NET
Farzad Wadia
 
PPT
ADO .Net
DrSonali Vyas
 
PPTX
Chapter 3: ado.net
Ngeam Soly
 
PPT
ADO CONTROLS - Database usage
Muralidharan Radhakrishnan
 
PPTX
Ado.net
Sangeetha Rangarajan
 
PPTX
ADO.NET -database connection
Anekwong Yoddumnern
 
PDF
Ado.Net Architecture
Umar Farooq
 
PPTX
ADO.NET by ASP.NET Development Company in india
iFour Institute - Sustainable Learning
 
PPT
Chap14 ado.net
mentorrbuddy
 
PPT
Introduction to ADO.NET
rchakra
 
PPS
Vb.net session 05
Niit Care
 
PPTX
Ado.Net Tutorial
prabhu rajendran
 
PPT
Ado.net &amp; data persistence frameworks
Luis Goldster
 
PPTX
Ch06 ado.net fundamentals
Madhuri Kavade
 
PPTX
Data base connectivity and flex grid in vb
Amandeep Kaur
 
PPT
For Beginers - ADO.Net
Snehal Harawande
 
PPTX
Database connectivity to sql server asp.net
Hemant Sankhla
 
PPTX
Ch 7 data binding
Madhuri Kavade
 
Ado.net
Om Prakash
 
ReactJS
Ram Murat Sharma
 
ADO.NET
Farzad Wadia
 
ADO .Net
DrSonali Vyas
 
Chapter 3: ado.net
Ngeam Soly
 
ADO CONTROLS - Database usage
Muralidharan Radhakrishnan
 
ADO.NET -database connection
Anekwong Yoddumnern
 
Ado.Net Architecture
Umar Farooq
 
ADO.NET by ASP.NET Development Company in india
iFour Institute - Sustainable Learning
 
Chap14 ado.net
mentorrbuddy
 
Introduction to ADO.NET
rchakra
 
Vb.net session 05
Niit Care
 
Ado.Net Tutorial
prabhu rajendran
 
Ado.net &amp; data persistence frameworks
Luis Goldster
 
Ch06 ado.net fundamentals
Madhuri Kavade
 
Data base connectivity and flex grid in vb
Amandeep Kaur
 
For Beginers - ADO.Net
Snehal Harawande
 
Database connectivity to sql server asp.net
Hemant Sankhla
 
Ch 7 data binding
Madhuri Kavade
 

Viewers also liked (19)

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

Similar to Connected data classes (20)

PPT
Chapter 4 event it theory programming.pptx
kmkkali41
 
PPTX
6 database
siragezeynu
 
PPT
Introduction to ado
Harman Bajwa
 
DOCX
Ado dot net complete meterial (1)
Mubarak Hussain
 
PPT
Introduction to ado.net
Paneliya Prince
 
PPTX
PPT temp.pptx
Raghunathan52
 
PPTX
111111112222223333335555555666Unit-4.pptx
sachaniajay26
 
PPT
the .NET Framework. It provides the claf
TesfahunMaru1
 
PPT
Final Database Connectivity in JAVA.ppt
TabassumMaktum
 
PPT
JDBC.ppt
ChagantiSahith
 
DOC
Ado
actacademy
 
PPT
Java Database Connectivity
backdoor
 
PPT
Data Access Technologies
Dimara Hakim
 
PPTX
Ado.net
pacatarpit
 
PPTX
Chapter 14
application developer
 
PPTX
Mule jdbc
Rajarajan Sadhasivam
 
PPTX
Is2215 lecture7 lecturer_ado_intro
dannygriff1
 
PPS
Ado.net session05
Niit Care
 
PDF
Unit4
Abha Damani
 
PPT
Jdbc
leminhvuong
 
Chapter 4 event it theory programming.pptx
kmkkali41
 
6 database
siragezeynu
 
Introduction to ado
Harman Bajwa
 
Ado dot net complete meterial (1)
Mubarak Hussain
 
Introduction to ado.net
Paneliya Prince
 
PPT temp.pptx
Raghunathan52
 
111111112222223333335555555666Unit-4.pptx
sachaniajay26
 
the .NET Framework. It provides the claf
TesfahunMaru1
 
Final Database Connectivity in JAVA.ppt
TabassumMaktum
 
JDBC.ppt
ChagantiSahith
 
Ado
actacademy
 
Java Database Connectivity
backdoor
 
Data Access Technologies
Dimara Hakim
 
Ado.net
pacatarpit
 
Chapter 14
application developer
 
Is2215 lecture7 lecturer_ado_intro
dannygriff1
 
Ado.net session05
Niit Care
 
Unit4
Abha Damani
 
Jdbc
leminhvuong
 
Ad

Recently uploaded (20)

PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
July Patch Tuesday
Ivanti
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 

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