SlideShare ist ein Scribd-Unternehmen logo
1 von 41
DATABASES IN VISUAL BASIC.NET

ADO.NET
ADO .NET


  ADO.NET is an OO framework that allows
   you to interact with DBs
  Can use ADO.NET through code, or by using
   bounded controls
  ADO.NET extremely flexible and efficient
ADO.NET

   Previously applications would talk to Database
      using SQL
     The application would be constantly connected
      to the DB
     We still use SQL but the data is disconnected
     It will connect to a database server when it
      needs to run a query and then disconnects
      immediately
     ADO.NET still provides the connection
      oriented traditional approach.
Traditional Data Access
Architecture

1. Makes a Connection
2. Pass some query to DB and reads result
3. Pass another query to DB and reads result
4. Disconnects from DB System
ADO.NET Disconnected Model

1. Make a connection
2. Pass query and gets back result
3. Disconnects
4. Makes connection again
5. Passes another query and gets result
6. Disconnects from the DB
ADO.NET

 Keeps a local virtual copy of the database in
  your application
 All of the generic classes for data access are
  stored in the System.Data Namespace.
ADO.NET

   ADO.NET uses managed providers to
    connect to databases
   Managed providers allow fast data streams
    from databases
   Deals with security such as database locks,
    passwords etc.,
Main Components of ADO.NET

Object          Description

Connection      Creates a connection to the data
                source
Command         Provides access to commands
                that can be executed against the
                data source
DataAdapter     Serves as an ambassador
                between your dataset and
                datasource, maps instructions
                between the two
DataSet         Provides an in-memory
                representation of your data source
DataReader      Read-Only forward stream
                containing your data
Advantages

 Interoperability
   Data is transported as XML
   Can be read by anyone on any platform
 Scalability
   Client Server model is gone
   ADO promotes the use of disconnected datasets
 Productivity
   Quicker
   Less Bugs
Advantages Cont’d

 Performance
   Disconnected datasets
   Database Server is no longer a bottleneck
   Performance boost
   Concurrency
   Database not locked out all the time
Using ADO.NET in Code

1. Set up your objects
2. Connect to DB using connection object
3. Set up the data adapter
4. Copy data from data adapter to Dataset
Connecting to a DB in Code
USING ADO.NET WITH ACCESS DB
A Simple DB Application
Code Cont’d
Code Cont’d
Code Cont’d
Doing it In Code

 An access Database Table
 It will be represented in our DataSet as a Table
 The first table is given an index of 0
 The first row in the table has an index value of 0
  also
 The first column has a value of 0
Code Cont’d
The Code

Set up the objects
The Code

Set up the objects
The Code

Set up the objects
The Code

Set up the objects
The Code

Set up the objects
The Code

Fill the DataSet using the DataAdapter
The Code – Displaying the
      DataSet Contents
 Point a textbox to a row and column of the dataset
  Table
 Point a DataGrid control at a DataSet




    .........................................................................................................
    .
The Code: Counting the
Number of Rows
 Point a textbox to a row and column of the dataset
  Table
 Point a DataGrid control at a DataSet




    .........................................................................................................
    .
Customising the Generic
Code
Set Up the Objects
The Form Load Code
The UpdateTextBoxes Sub
Procedure
Navigation Code: Previous
Record
Navigation Code: Next Record
Navigation Code: Find Record

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Ado.net
Ado.netAdo.net
Ado.net
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb net
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Database Basics Taac 2005
Database Basics Taac 2005Database Basics Taac 2005
Database Basics Taac 2005
 
Vb.net session 05
Vb.net session 05Vb.net session 05
Vb.net session 05
 
ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
ADO.NET difference faqs compiled- 1
ADO.NET difference  faqs compiled- 1ADO.NET difference  faqs compiled- 1
ADO.NET difference faqs compiled- 1
 
Introduction to ado.net
Introduction to ado.netIntroduction to ado.net
Introduction to ado.net
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
Presentation
PresentationPresentation
Presentation
 
For Beginners - Ado.net
For Beginners - Ado.netFor Beginners - Ado.net
For Beginners - Ado.net
 
Assignment#10
Assignment#10Assignment#10
Assignment#10
 
Ado.net
Ado.netAdo.net
Ado.net
 
Ef code first
Ef code firstEf code first
Ef code first
 
IRJET- Review on Java Database Connectivity
IRJET- Review on Java Database ConnectivityIRJET- Review on Java Database Connectivity
IRJET- Review on Java Database Connectivity
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
Lecture13
Lecture13Lecture13
Lecture13
 
2310 b 09
2310 b 092310 b 09
2310 b 09
 

Andere mochten auch

Is2215 lecture5 lecturer_g_cand_classlibraries
Is2215 lecture5 lecturer_g_cand_classlibrariesIs2215 lecture5 lecturer_g_cand_classlibraries
Is2215 lecture5 lecturer_g_cand_classlibrariesdannygriff1
 
Is2215 lecture8 relational_databases
Is2215 lecture8 relational_databasesIs2215 lecture8 relational_databases
Is2215 lecture8 relational_databasesdannygriff1
 
Is2215 lecture4 student (1)
Is2215 lecture4 student (1)Is2215 lecture4 student (1)
Is2215 lecture4 student (1)dannygriff1
 
Ec2204 tutorial 6(1)
Ec2204 tutorial 6(1)Ec2204 tutorial 6(1)
Ec2204 tutorial 6(1)dannygriff1
 
Ec2204 tutorial 2(2)
Ec2204 tutorial 2(2)Ec2204 tutorial 2(2)
Ec2204 tutorial 2(2)dannygriff1
 
Learn VB.NET at ASIT
Learn VB.NET at ASITLearn VB.NET at ASIT
Learn VB.NET at ASITASIT
 
Is2215 lecture2 student(2)
Is2215 lecture2 student(2)Is2215 lecture2 student(2)
Is2215 lecture2 student(2)dannygriff1
 
Ec2204 tutorial 4(1)
Ec2204 tutorial 4(1)Ec2204 tutorial 4(1)
Ec2204 tutorial 4(1)dannygriff1
 
Is2215 lecture6 lecturer_file_access
Is2215 lecture6 lecturer_file_accessIs2215 lecture6 lecturer_file_access
Is2215 lecture6 lecturer_file_accessdannygriff1
 
Stocks&bonds2214 1
Stocks&bonds2214 1Stocks&bonds2214 1
Stocks&bonds2214 1dannygriff1
 
Profitability&npv
Profitability&npvProfitability&npv
Profitability&npvdannygriff1
 

Andere mochten auch (12)

Is2215 lecture5 lecturer_g_cand_classlibraries
Is2215 lecture5 lecturer_g_cand_classlibrariesIs2215 lecture5 lecturer_g_cand_classlibraries
Is2215 lecture5 lecturer_g_cand_classlibraries
 
Is2215 lecture8 relational_databases
Is2215 lecture8 relational_databasesIs2215 lecture8 relational_databases
Is2215 lecture8 relational_databases
 
Is2215 lecture4 student (1)
Is2215 lecture4 student (1)Is2215 lecture4 student (1)
Is2215 lecture4 student (1)
 
Ec2204 tutorial 6(1)
Ec2204 tutorial 6(1)Ec2204 tutorial 6(1)
Ec2204 tutorial 6(1)
 
Ec2204 tutorial 2(2)
Ec2204 tutorial 2(2)Ec2204 tutorial 2(2)
Ec2204 tutorial 2(2)
 
Learn VB.NET at ASIT
Learn VB.NET at ASITLearn VB.NET at ASIT
Learn VB.NET at ASIT
 
Is2215 lecture2 student(2)
Is2215 lecture2 student(2)Is2215 lecture2 student(2)
Is2215 lecture2 student(2)
 
Ec2204 tutorial 4(1)
Ec2204 tutorial 4(1)Ec2204 tutorial 4(1)
Ec2204 tutorial 4(1)
 
Is2215 lecture6 lecturer_file_access
Is2215 lecture6 lecturer_file_accessIs2215 lecture6 lecturer_file_access
Is2215 lecture6 lecturer_file_access
 
Stocks&bonds2214 1
Stocks&bonds2214 1Stocks&bonds2214 1
Stocks&bonds2214 1
 
Mcq sample
Mcq sampleMcq sample
Mcq sample
 
Profitability&npv
Profitability&npvProfitability&npv
Profitability&npv
 

Ähnlich wie Is2215 lecture7 lecturer_ado_intro

Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Mubarak Hussain
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to adoHarman Bajwa
 
Latest Advance Animated Ado.Net With JDBC
Latest Advance Animated Ado.Net With JDBC Latest Advance Animated Ado.Net With JDBC
Latest Advance Animated Ado.Net With JDBC Tarun Jain
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaSonu Vishwakarma
 
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdfguest5eed7
 
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdfguest5eed7
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworksLuis Goldster
 
Connected data classes
Connected data classesConnected data classes
Connected data classesaspnet123
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desaijmsthakur
 
Final Database Connectivity in JAVA.ppt
Final Database Connectivity in JAVA.pptFinal Database Connectivity in JAVA.ppt
Final Database Connectivity in JAVA.pptTabassumMaktum
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net ArchitectureUmar Farooq
 

Ähnlich wie Is2215 lecture7 lecturer_ado_intro (20)

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
Introduction to adoIntroduction to ado
Introduction to ado
 
Latest Advance Animated Ado.Net With JDBC
Latest Advance Animated Ado.Net With JDBC Latest Advance Animated Ado.Net With JDBC
Latest Advance Animated Ado.Net With JDBC
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu Vishwakarma
 
Session x(ado.net)
Session x(ado.net)Session x(ado.net)
Session x(ado.net)
 
Unit4
Unit4Unit4
Unit4
 
PPT temp.pptx
PPT temp.pptxPPT temp.pptx
PPT temp.pptx
 
Ado
AdoAdo
Ado
 
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
 
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
6 Slidesdfsdfsdhbkdflgjdflgjlkeroueriotr,Dnghkfxhckghdsflhl;Jkjlahfdhklgfdgdf
 
unit 3.docx
unit 3.docxunit 3.docx
unit 3.docx
 
6 database
6 database 6 database
6 database
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworks
 
Ado.net
Ado.netAdo.net
Ado.net
 
Connected data classes
Connected data classesConnected data classes
Connected data classes
 
Ado Net
Ado NetAdo Net
Ado Net
 
Microsoft data access components
Microsoft data access componentsMicrosoft data access components
Microsoft data access components
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desai
 
Final Database Connectivity in JAVA.ppt
Final Database Connectivity in JAVA.pptFinal Database Connectivity in JAVA.ppt
Final Database Connectivity in JAVA.ppt
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 

Mehr von dannygriff1

Ec2204 tutorial 8(2)
Ec2204 tutorial 8(2)Ec2204 tutorial 8(2)
Ec2204 tutorial 8(2)dannygriff1
 
Ec2204 tutorial 3(1)
Ec2204 tutorial 3(1)Ec2204 tutorial 3(1)
Ec2204 tutorial 3(1)dannygriff1
 
Ec2204 tutorial 1(2)
Ec2204 tutorial 1(2)Ec2204 tutorial 1(2)
Ec2204 tutorial 1(2)dannygriff1
 
6 price and output determination- monopoly
6 price and output determination- monopoly6 price and output determination- monopoly
6 price and output determination- monopolydannygriff1
 
5 industry structure and competition analysis
5  industry structure and competition analysis5  industry structure and competition analysis
5 industry structure and competition analysisdannygriff1
 
4 production and cost
4  production and cost4  production and cost
4 production and costdannygriff1
 
3 consumer choice
3 consumer choice3 consumer choice
3 consumer choicedannygriff1
 
2 demand-supply and elasticity
2  demand-supply and elasticity2  demand-supply and elasticity
2 demand-supply and elasticitydannygriff1
 
1 goals of the firm
1  goals of the firm1  goals of the firm
1 goals of the firmdannygriff1
 
Is2215 lecture3 student (1)
Is2215 lecture3 student (1)Is2215 lecture3 student (1)
Is2215 lecture3 student (1)dannygriff1
 

Mehr von dannygriff1 (15)

Risk08a
Risk08aRisk08a
Risk08a
 
Npvrisk
NpvriskNpvrisk
Npvrisk
 
Npv2214(1)
Npv2214(1)Npv2214(1)
Npv2214(1)
 
Irr(1)
Irr(1)Irr(1)
Irr(1)
 
Npv rule
Npv ruleNpv rule
Npv rule
 
Ec2204 tutorial 8(2)
Ec2204 tutorial 8(2)Ec2204 tutorial 8(2)
Ec2204 tutorial 8(2)
 
Ec2204 tutorial 3(1)
Ec2204 tutorial 3(1)Ec2204 tutorial 3(1)
Ec2204 tutorial 3(1)
 
Ec2204 tutorial 1(2)
Ec2204 tutorial 1(2)Ec2204 tutorial 1(2)
Ec2204 tutorial 1(2)
 
6 price and output determination- monopoly
6 price and output determination- monopoly6 price and output determination- monopoly
6 price and output determination- monopoly
 
5 industry structure and competition analysis
5  industry structure and competition analysis5  industry structure and competition analysis
5 industry structure and competition analysis
 
4 production and cost
4  production and cost4  production and cost
4 production and cost
 
3 consumer choice
3 consumer choice3 consumer choice
3 consumer choice
 
2 demand-supply and elasticity
2  demand-supply and elasticity2  demand-supply and elasticity
2 demand-supply and elasticity
 
1 goals of the firm
1  goals of the firm1  goals of the firm
1 goals of the firm
 
Is2215 lecture3 student (1)
Is2215 lecture3 student (1)Is2215 lecture3 student (1)
Is2215 lecture3 student (1)
 

Is2215 lecture7 lecturer_ado_intro

  • 1. DATABASES IN VISUAL BASIC.NET ADO.NET
  • 2. ADO .NET  ADO.NET is an OO framework that allows you to interact with DBs  Can use ADO.NET through code, or by using bounded controls  ADO.NET extremely flexible and efficient
  • 3. ADO.NET  Previously applications would talk to Database using SQL  The application would be constantly connected to the DB  We still use SQL but the data is disconnected  It will connect to a database server when it needs to run a query and then disconnects immediately  ADO.NET still provides the connection oriented traditional approach.
  • 4. Traditional Data Access Architecture 1. Makes a Connection 2. Pass some query to DB and reads result 3. Pass another query to DB and reads result 4. Disconnects from DB System
  • 5. ADO.NET Disconnected Model 1. Make a connection 2. Pass query and gets back result 3. Disconnects 4. Makes connection again 5. Passes another query and gets result 6. Disconnects from the DB
  • 6. ADO.NET  Keeps a local virtual copy of the database in your application  All of the generic classes for data access are stored in the System.Data Namespace.
  • 7. ADO.NET  ADO.NET uses managed providers to connect to databases  Managed providers allow fast data streams from databases  Deals with security such as database locks, passwords etc.,
  • 8. Main Components of ADO.NET Object Description Connection Creates a connection to the data source Command Provides access to commands that can be executed against the data source DataAdapter Serves as an ambassador between your dataset and datasource, maps instructions between the two DataSet Provides an in-memory representation of your data source DataReader Read-Only forward stream containing your data
  • 9. Advantages  Interoperability  Data is transported as XML  Can be read by anyone on any platform  Scalability  Client Server model is gone  ADO promotes the use of disconnected datasets  Productivity  Quicker  Less Bugs
  • 10. Advantages Cont’d  Performance  Disconnected datasets  Database Server is no longer a bottleneck  Performance boost  Concurrency  Database not locked out all the time
  • 11. Using ADO.NET in Code 1. Set up your objects 2. Connect to DB using connection object 3. Set up the data adapter 4. Copy data from data adapter to Dataset
  • 12.
  • 13. Connecting to a DB in Code USING ADO.NET WITH ACCESS DB
  • 14. A Simple DB Application
  • 18. Doing it In Code  An access Database Table  It will be represented in our DataSet as a Table  The first table is given an index of 0  The first row in the table has an index value of 0 also  The first column has a value of 0
  • 19.
  • 21. The Code Set up the objects
  • 22.
  • 23. The Code Set up the objects
  • 24.
  • 25. The Code Set up the objects
  • 26.
  • 27. The Code Set up the objects
  • 28.
  • 29. The Code Set up the objects
  • 30.
  • 31. The Code Fill the DataSet using the DataAdapter
  • 32. The Code – Displaying the DataSet Contents  Point a textbox to a row and column of the dataset Table  Point a DataGrid control at a DataSet ......................................................................................................... .
  • 33. The Code: Counting the Number of Rows
  • 34.  Point a textbox to a row and column of the dataset Table  Point a DataGrid control at a DataSet ......................................................................................................... .
  • 36. Set Up the Objects