SlideShare a Scribd company logo
1 of 16
   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
   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
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)

Ado.net
Ado.netAdo.net
Ado.net
 
ReactJS
ReactJSReactJS
ReactJS
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Chapter 3: ado.net
Chapter 3: ado.netChapter 3: ado.net
Chapter 3: ado.net
 
ADO CONTROLS - Database usage
ADO CONTROLS - Database usageADO CONTROLS - Database usage
ADO CONTROLS - Database usage
 
Ado.net
Ado.netAdo.net
Ado.net
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
ADO.NET by ASP.NET Development Company in india
ADO.NET by ASP.NET  Development Company in indiaADO.NET by ASP.NET  Development Company in india
ADO.NET by ASP.NET Development Company in india
 
Chap14 ado.net
Chap14 ado.netChap14 ado.net
Chap14 ado.net
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NET
 
Vb.net session 05
Vb.net session 05Vb.net session 05
Vb.net session 05
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
Ado.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksAdo.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworks
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
Data base connectivity and flex grid in vb
Data base connectivity and flex grid in vbData base connectivity and flex grid in vb
Data base connectivity and flex grid in vb
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
Database connectivity to sql server asp.net
Database connectivity to sql server asp.netDatabase connectivity to sql server asp.net
Database connectivity to sql server asp.net
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 

Viewers also liked (19)

Blood group
Blood groupBlood group
Blood group
 
Chapter 5 notes
Chapter 5 notesChapter 5 notes
Chapter 5 notes
 
Working with xml data
Working with xml dataWorking with xml data
Working with xml data
 
Come sfruttare la Procedural Content Generation - Presentazione svilupparty 2014
Come sfruttare la Procedural Content Generation - Presentazione svilupparty 2014Come sfruttare la Procedural Content Generation - Presentazione svilupparty 2014
Come sfruttare la Procedural Content Generation - Presentazione svilupparty 2014
 
Web services
Web servicesWeb services
Web services
 
Deploying configuring caching
Deploying configuring cachingDeploying configuring caching
Deploying configuring caching
 
Introducing asp
Introducing aspIntroducing asp
Introducing asp
 
Profile
ProfileProfile
Profile
 
Mobile application
Mobile applicationMobile application
Mobile application
 
User controls
User controlsUser controls
User controls
 
Programming web application
Programming web applicationProgramming web application
Programming web application
 
Monitoring, troubleshooting,
Monitoring, troubleshooting,Monitoring, troubleshooting,
Monitoring, troubleshooting,
 
Custom controls
Custom controlsCustom controls
Custom controls
 
Globalization and accessibility
Globalization and accessibilityGlobalization and accessibility
Globalization and accessibility
 
1 blood basic facts final
1 blood basic facts final1 blood basic facts final
1 blood basic facts final
 
Disconnected data
Disconnected dataDisconnected data
Disconnected data
 
Intelligent exercise selection for posture and health.
Intelligent exercise selection for posture and health. Intelligent exercise selection for posture and health.
Intelligent exercise selection for posture and health.
 
Chapter 8 notes
Chapter 8 notesChapter 8 notes
Chapter 8 notes
 
Hemoglobin & its functions plasma
Hemoglobin & its  functions plasmaHemoglobin & its  functions plasma
Hemoglobin & its functions plasma
 

Similar to Connected data classes

Similar to Connected data classes (20)

6 database
6 database 6 database
6 database
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
 
Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Ado dot net complete meterial (1)
Ado dot net complete meterial (1)
 
Introduction to ado.net
Introduction to ado.netIntroduction to ado.net
Introduction to ado.net
 
PPT temp.pptx
PPT temp.pptxPPT temp.pptx
PPT temp.pptx
 
Final Database Connectivity in JAVA.ppt
Final Database Connectivity in JAVA.pptFinal Database Connectivity in JAVA.ppt
Final Database Connectivity in JAVA.ppt
 
JDBC.ppt
JDBC.pptJDBC.ppt
JDBC.ppt
 
Ado
AdoAdo
Ado
 
Java Database Connectivity
Java Database ConnectivityJava Database Connectivity
Java Database Connectivity
 
Data Access Technologies
Data Access TechnologiesData Access Technologies
Data Access Technologies
 
Ado.net
Ado.netAdo.net
Ado.net
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Mule jdbc
Mule   jdbcMule   jdbc
Mule jdbc
 
Is2215 lecture7 lecturer_ado_intro
Is2215 lecture7 lecturer_ado_introIs2215 lecture7 lecturer_ado_intro
Is2215 lecture7 lecturer_ado_intro
 
Ado.net session05
Ado.net session05Ado.net session05
Ado.net session05
 
Unit4
Unit4Unit4
Unit4
 
Jdbc
JdbcJdbc
Jdbc
 
Jdbc
JdbcJdbc
Jdbc
 
15. session 15 data binding
15. session 15   data binding15. session 15   data binding
15. session 15 data binding
 
15. session 15 data binding
15. session 15   data binding15. session 15   data binding
15. session 15 data binding
 

Recently uploaded

Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...caitlingebhard1
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governanceWSO2
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaWSO2
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingWSO2
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Recently uploaded (20)

Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Connected data classes

  • 1.
  • 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
  • 4.
  • 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
  • 10.
  • 11.
  • 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