SlideShare una empresa de Scribd logo
1 de 15
Developing Database Applications Using ADO.NET and XML
Objectives


                In this session, you will learn to:
                   Working in a connected environment




     Ver. 1.0                      Session 5            Slide 1 of 15
Developing Database Applications Using ADO.NET and XML
Working with Data Adapters


                A data adapter is integral to the working of ADO.NET
                because data is transferred to and from a database through
                a data adapter.
                A data adapter retrieves data from a database into a
                dataset.
                The data adapter first compares the data in the dataset with
                that in the database and then updates the database.
                Data from a database can be accessed by configuring a
                data adapter.




     Ver. 1.0                    Session 5                           Slide 2 of 15
Developing Database Applications Using ADO.NET and XML
Working with Data Adapters (Contd.)


                Following are the data adapters that can be configured to
                connect to a database:
                  SqlDataAdapter              Accesses data specifically from
                                               Microsoft SQL Server

                  OleDbDataAdapter            Accesses data from a database that is
                                               supported by an OLE DB data provider

                  OdbcDataAdapter             Accesses data from a database that is
                                               supported by an ODBC data provider

                  OracleDataAdapter Accesses data from a database that is
                                               supported by an Oracle data provider




     Ver. 1.0                      Session 5                                           Slide 3 of 15
Developing Database Applications Using ADO.NET and XML
Working with Data Adapters (Contd.)


                The following properties and methods of a data adapter can
                be used to perform various operations on a database:
                 SelectCommand              Refers to a DML statement or a stored procedure
                                             to retrieve data from a database

                 InsertCommand              Refers to a data command to insert data into a
                                             database

                 UpdateCommand              Refers to a data command to update a database


                 DeleteCommand              Refers to a data command to delete data from a
                                             database

                 Fill()                     Fills the dataset with the records from a database


                 Update()                   Executes the corresponding Insert, Update, or
                                             Delete commands for each inserted, modified,
                                             or deleted row to reflect the changes in a
                                             database
     Ver. 1.0                    Session 5                                           Slide 4 of 15
Developing Database Applications Using ADO.NET and XML
Working with Data Adapters (Contd.)


                •   Consider the following code snippet of creating a
                    DataAdapter object and using the SelectCommand
                    property of the object:
                    SqlConnection cn = new
                    SqlConnection();
                    cn.ConnectionString = "Data      Set a connection string

                    source=SQLSERVER01;Initial
                    catalog=HR;User id=sa;
                    Password=niit#1234";
                    DataSet DataSet1 = new DataSet();Creating a DataSet object
                    SqlDataAdapter da = new          Creating a SqlDataAdapter
                    SqlDataAdapter();                object

                    SqlCommand cmd=new SqlCommand    Passing the SQL query to the
                    ("Select * from Employees", cn); command object.
                    da.SelectCommand = cmd;          Retrieving records from the
                                                     Filling the dataset
                                                     Employees table with records
                    da.Fill(DataSet1);               from the Employees table
     Ver. 1.0                        Session 5                            Slide 5 of 15
Developing Database Applications Using ADO.NET and XML
Working with Data Adapters (Contd.)


                •   A data adapter handles data transfer between the database
                    and the dataset through its properties and methods, and
                    displays data through the process of table mapping.
                •   After a dataset has been created, the data adapter uses the
                    process of table mapping to map the columns in the
                    database table with the dataset columns.
                •   A data adapter uses the TableMappings property, a
                    collection of DatatableMapping objects that is used for
                    mapping between the database table and the DataTable
                    object in the dataset.




     Ver. 1.0                        Session 5                          Slide 6 of 15
Developing Database Applications Using ADO.NET and XML
Working with Data Adapters (Contd.)


                A major challenge related to data access is that more than
                one user might need to simultaneously access data in a
                database.
                Another challenge is more than one user might need to
                access the data anytime, anywhere. This challenge can be
                overcome by implementing database locking while a
                transaction is executing.
                However, if database locking is not implemented, it can lead
                to data concurrency conflicts that arise from multiple
                updates being performed on the database.




     Ver. 1.0                    Session 5                           Slide 7 of 15
Developing Database Applications Using ADO.NET and XML
Working with Data Adapters (Contd.)


                Resolving data concurrency conflicts is a business decision,
                with the following choices:
                   Prioritized on time; first update wins
                   Prioritized on time; last update wins
                   Prioritized on role
                   Prioritized on location
                   User resolves the conflict




     Ver. 1.0                       Session 5                        Slide 8 of 15
Developing Database Applications Using ADO.NET and XML
Working with Data Adapters (Contd.)


                A significant way to increase the performance of data
                updates is to update and send the changes to the database
                in batches. This is known as batch updates.
                Batch updates are performed by using the
                UpdateBatchSize property of the SqlDataAdapter
                object.
                By default, the UpdateBatchSize property is set to 1.
                One way to confirm that the changes are being sent to the
                database server in batches is to add a RowUpdated event
                to the SqlDataAdapter object. This event will show the
                number of rows affected in the last batch.




     Ver. 1.0                    Session 5                        Slide 9 of 15
Developing Database Applications Using ADO.NET and XML
Working with Data Adapters (Contd.)


                •   ADO.NET provides support for classes that can create any
                    provider-specific objects. These classes are known as the
                    DbProviderFactories classes.
                •   The DbProviderFactories class contains a method
                    called GetFactoryClasses that returns a data table,
                    which is populated with data from various providers, as
                    shown in the following figure.




     Ver. 1.0                        Session 5                         Slide 10 of 15
Developing Database Applications Using ADO.NET and XML
Just a minute


                _______ class can create any data provider-specific object.
                 1.   DbCommand
                 2.   DbProviderFactories
                 3.   DbParameter
                 4.   DbConnection




                Answer:
                 2. DbProviderFactories



     Ver. 1.0                    Session 5                          Slide 11 of 15
Developing Database Applications Using ADO.NET and XML
Demo: Manipulating Data in a Connected Environment


                Problem Statement:
                   The HR Manager of Tebisco needs to update the number of
                   vacancies, for those positions where the number of vacancies
                   is not more than 10. This updation will be based on the current
                   position code of employees.
                   As a part of the development team, you need to execute two
                   queries, one to retrieve the number of vacancies per position
                   code, and the other to update the number of vacancies on the
                   basis of the current position code of employees.
                   You need to develop an application that can execute both
                   queries on a single database connection.
                   Hint: You need to access the InternalJobPosting and
                   Employee tables of the HR database.




     Ver. 1.0                      Session 5                              Slide 12 of 15
Developing Database Applications Using ADO.NET and XML
Summary


               In this session, you learned that:
                 A data adapter, which is a part of the connected environment,
                  retrieves data from a database into a dataset.
                 The data adapters that can be configured to connect to a
                  database in Visual Studio .NET are:
                      SqlDataAdapter
                      OleDbDataAdapter
                      OdbcDataAdapter
                      OracleDataAdapter




    Ver. 1.0                      Session 5                             Slide 13 of 15
Developing Database Applications Using ADO.NET and XML
Summary (Contd.)


                 The following properties and methods of a data adapter can be
                 used to perform the various operations on a database:
                     SelectCommand
                     InsertCommand
                     UpdateCommand
                     DeleteCommand
                     Fill()
                     Update()
                A data adapter handles data transfer between the database
                 and the dataset through its properties and methods, and
                 displays the data through the process of table mapping.




    Ver. 1.0                    Session 5                             Slide 14 of 15
Developing Database Applications Using ADO.NET and XML
Summary (Contd.)


                 Resolving data concurrency conflicts is a business decision,
                 with the following choices:
                     Prioritized on time; first update wins
                     Prioritized on time; last update wins
                     Prioritized on role
                     Prioritized on location
                     User resolves the conflict
                A significant way to increase the performance of data updates
                 is to update and send the changes to the database in batches.
                 This is known as batch updates.
                ADO.NET provides support for classes that can create any
                 provider-specific objects, such as SqlClient, Odbc,
                 OracleClient, and OleDb. These classes are known as
                 DbProviderFactories classes.



    Ver. 1.0                        Session 5                          Slide 15 of 15

Más contenido relacionado

La actualidad más candente

Visual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetVisual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetFaRid Adwa
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to adoHarman Bajwa
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb netZishan yousaf
 
ADO.NET difference faqs compiled- 1
ADO.NET difference  faqs compiled- 1ADO.NET difference  faqs compiled- 1
ADO.NET difference faqs compiled- 1Umar Ali
 
Disconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NETDisconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NETEverywhere
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#Michael Heron
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net ArchitectureUmar Farooq
 
JAM819 - Native API Deep Dive: Data Storage and Retrieval
JAM819 - Native API Deep Dive: Data Storage and RetrievalJAM819 - Native API Deep Dive: Data Storage and Retrieval
JAM819 - Native API Deep Dive: Data Storage and RetrievalDr. Ranbijay Kumar
 
Graph db as metastore
Graph db as metastoreGraph db as metastore
Graph db as metastoreHaris Khan
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverAmmara Arooj
 
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
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1Mahmoud Ouf
 

La actualidad más candente (20)

Visual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetVisual Basic.Net & Ado.Net
Visual Basic.Net & Ado.Net
 
Ado.net
Ado.netAdo.net
Ado.net
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb net
 
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
 
Disconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NETDisconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NET
 
2310 b 09
2310 b 092310 b 09
2310 b 09
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
Database Connection
Database ConnectionDatabase Connection
Database Connection
 
Intake 38 10
Intake 38 10Intake 38 10
Intake 38 10
 
Unit4
Unit4Unit4
Unit4
 
JAM819 - Native API Deep Dive: Data Storage and Retrieval
JAM819 - Native API Deep Dive: Data Storage and RetrievalJAM819 - Native API Deep Dive: Data Storage and Retrieval
JAM819 - Native API Deep Dive: Data Storage and Retrieval
 
Graph db as metastore
Graph db as metastoreGraph db as metastore
Graph db as metastore
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql server
 
Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Ado dot net complete meterial (1)
Ado dot net complete meterial (1)
 
Ado
AdoAdo
Ado
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1
 

Destacado

Ado.net session11
Ado.net session11Ado.net session11
Ado.net session11Niit Care
 
Technology Based learning at NIIT University
Technology Based learning at NIIT University Technology Based learning at NIIT University
Technology Based learning at NIIT University I Love Science
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05Niit Care
 

Destacado (7)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ado.net session11
Ado.net session11Ado.net session11
Ado.net session11
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-2 a
Dacj 1-2 aDacj 1-2 a
Dacj 1-2 a
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
Technology Based learning at NIIT University
Technology Based learning at NIIT University Technology Based learning at NIIT University
Technology Based learning at NIIT University
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
 

Similar a Ado.net session05

Similar a Ado.net session05 (20)

Ado .net
Ado .netAdo .net
Ado .net
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu Vishwakarma
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
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
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desai
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Introduction to ado.net
Introduction to ado.netIntroduction to ado.net
Introduction to ado.net
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
Connected data classes
Connected data classesConnected data classes
Connected data classes
 
6 database
6 database 6 database
6 database
 
Chapter 3: ado.net
Chapter 3: ado.netChapter 3: ado.net
Chapter 3: ado.net
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Ado
AdoAdo
Ado
 
Vb net xp_05
Vb net xp_05Vb net xp_05
Vb net xp_05
 
Is2215 lecture7 lecturer_ado_intro
Is2215 lecture7 lecturer_ado_introIs2215 lecture7 lecturer_ado_intro
Is2215 lecture7 lecturer_ado_intro
 
Day4
Day4Day4
Day4
 
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
 
5.C#
5.C#5.C#
5.C#
 
Vb.net session 16
Vb.net session 16Vb.net session 16
Vb.net session 16
 

Más de Niit Care (20)

Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 
Dacj 1-3 a
Dacj 1-3 aDacj 1-3 a
Dacj 1-3 a
 
Dacj 1-2 c
Dacj 1-2 cDacj 1-2 c
Dacj 1-2 c
 

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Ado.net session05

  • 1. Developing Database Applications Using ADO.NET and XML Objectives In this session, you will learn to: Working in a connected environment Ver. 1.0 Session 5 Slide 1 of 15
  • 2. Developing Database Applications Using ADO.NET and XML Working with Data Adapters A data adapter is integral to the working of ADO.NET because data is transferred to and from a database through a data adapter. A data adapter retrieves data from a database into a dataset. The data adapter first compares the data in the dataset with that in the database and then updates the database. Data from a database can be accessed by configuring a data adapter. Ver. 1.0 Session 5 Slide 2 of 15
  • 3. Developing Database Applications Using ADO.NET and XML Working with Data Adapters (Contd.) Following are the data adapters that can be configured to connect to a database:  SqlDataAdapter Accesses data specifically from Microsoft SQL Server  OleDbDataAdapter Accesses data from a database that is supported by an OLE DB data provider  OdbcDataAdapter Accesses data from a database that is supported by an ODBC data provider  OracleDataAdapter Accesses data from a database that is supported by an Oracle data provider Ver. 1.0 Session 5 Slide 3 of 15
  • 4. Developing Database Applications Using ADO.NET and XML Working with Data Adapters (Contd.) The following properties and methods of a data adapter can be used to perform various operations on a database:  SelectCommand Refers to a DML statement or a stored procedure to retrieve data from a database  InsertCommand Refers to a data command to insert data into a database  UpdateCommand Refers to a data command to update a database  DeleteCommand Refers to a data command to delete data from a database  Fill() Fills the dataset with the records from a database  Update() Executes the corresponding Insert, Update, or Delete commands for each inserted, modified, or deleted row to reflect the changes in a database Ver. 1.0 Session 5 Slide 4 of 15
  • 5. Developing Database Applications Using ADO.NET and XML Working with Data Adapters (Contd.) • Consider the following code snippet of creating a DataAdapter object and using the SelectCommand property of the object: SqlConnection cn = new SqlConnection(); cn.ConnectionString = "Data Set a connection string source=SQLSERVER01;Initial catalog=HR;User id=sa; Password=niit#1234"; DataSet DataSet1 = new DataSet();Creating a DataSet object SqlDataAdapter da = new Creating a SqlDataAdapter SqlDataAdapter(); object SqlCommand cmd=new SqlCommand Passing the SQL query to the ("Select * from Employees", cn); command object. da.SelectCommand = cmd; Retrieving records from the Filling the dataset Employees table with records da.Fill(DataSet1); from the Employees table Ver. 1.0 Session 5 Slide 5 of 15
  • 6. Developing Database Applications Using ADO.NET and XML Working with Data Adapters (Contd.) • A data adapter handles data transfer between the database and the dataset through its properties and methods, and displays data through the process of table mapping. • After a dataset has been created, the data adapter uses the process of table mapping to map the columns in the database table with the dataset columns. • A data adapter uses the TableMappings property, a collection of DatatableMapping objects that is used for mapping between the database table and the DataTable object in the dataset. Ver. 1.0 Session 5 Slide 6 of 15
  • 7. Developing Database Applications Using ADO.NET and XML Working with Data Adapters (Contd.) A major challenge related to data access is that more than one user might need to simultaneously access data in a database. Another challenge is more than one user might need to access the data anytime, anywhere. This challenge can be overcome by implementing database locking while a transaction is executing. However, if database locking is not implemented, it can lead to data concurrency conflicts that arise from multiple updates being performed on the database. Ver. 1.0 Session 5 Slide 7 of 15
  • 8. Developing Database Applications Using ADO.NET and XML Working with Data Adapters (Contd.) Resolving data concurrency conflicts is a business decision, with the following choices: Prioritized on time; first update wins Prioritized on time; last update wins Prioritized on role Prioritized on location User resolves the conflict Ver. 1.0 Session 5 Slide 8 of 15
  • 9. Developing Database Applications Using ADO.NET and XML Working with Data Adapters (Contd.) A significant way to increase the performance of data updates is to update and send the changes to the database in batches. This is known as batch updates. Batch updates are performed by using the UpdateBatchSize property of the SqlDataAdapter object. By default, the UpdateBatchSize property is set to 1. One way to confirm that the changes are being sent to the database server in batches is to add a RowUpdated event to the SqlDataAdapter object. This event will show the number of rows affected in the last batch. Ver. 1.0 Session 5 Slide 9 of 15
  • 10. Developing Database Applications Using ADO.NET and XML Working with Data Adapters (Contd.) • ADO.NET provides support for classes that can create any provider-specific objects. These classes are known as the DbProviderFactories classes. • The DbProviderFactories class contains a method called GetFactoryClasses that returns a data table, which is populated with data from various providers, as shown in the following figure. Ver. 1.0 Session 5 Slide 10 of 15
  • 11. Developing Database Applications Using ADO.NET and XML Just a minute _______ class can create any data provider-specific object. 1. DbCommand 2. DbProviderFactories 3. DbParameter 4. DbConnection Answer: 2. DbProviderFactories Ver. 1.0 Session 5 Slide 11 of 15
  • 12. Developing Database Applications Using ADO.NET and XML Demo: Manipulating Data in a Connected Environment Problem Statement: The HR Manager of Tebisco needs to update the number of vacancies, for those positions where the number of vacancies is not more than 10. This updation will be based on the current position code of employees. As a part of the development team, you need to execute two queries, one to retrieve the number of vacancies per position code, and the other to update the number of vacancies on the basis of the current position code of employees. You need to develop an application that can execute both queries on a single database connection. Hint: You need to access the InternalJobPosting and Employee tables of the HR database. Ver. 1.0 Session 5 Slide 12 of 15
  • 13. Developing Database Applications Using ADO.NET and XML Summary In this session, you learned that:  A data adapter, which is a part of the connected environment, retrieves data from a database into a dataset.  The data adapters that can be configured to connect to a database in Visual Studio .NET are: SqlDataAdapter OleDbDataAdapter OdbcDataAdapter OracleDataAdapter Ver. 1.0 Session 5 Slide 13 of 15
  • 14. Developing Database Applications Using ADO.NET and XML Summary (Contd.) The following properties and methods of a data adapter can be used to perform the various operations on a database:  SelectCommand  InsertCommand  UpdateCommand  DeleteCommand  Fill()  Update()  A data adapter handles data transfer between the database and the dataset through its properties and methods, and displays the data through the process of table mapping. Ver. 1.0 Session 5 Slide 14 of 15
  • 15. Developing Database Applications Using ADO.NET and XML Summary (Contd.) Resolving data concurrency conflicts is a business decision, with the following choices:  Prioritized on time; first update wins  Prioritized on time; last update wins  Prioritized on role  Prioritized on location  User resolves the conflict  A significant way to increase the performance of data updates is to update and send the changes to the database in batches. This is known as batch updates.  ADO.NET provides support for classes that can create any provider-specific objects, such as SqlClient, Odbc, OracleClient, and OleDb. These classes are known as DbProviderFactories classes. Ver. 1.0 Session 5 Slide 15 of 15

Notas del editor

  1. Introduce the students to the course by asking them what they know about forensics. Next, ask the students what they know about system forensics and why is it required in organizations dependent on IT. This could be a brief discussion of about 5 minutes. Lead the discussion to the objectives of this chapter.
  2. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  3. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  4. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  5. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  6. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  7. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  8. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  9. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  10. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  11. In this slide you need to show the calculation to determine the sum of an arithmetic progression for bubble sort algorithm. Refer to student guide.
  12. While explaining the definition of system forensics, ask the students to note the following key words in the definition: Identify Extract Process Analyze Digital and hardware evidence Tell the students that these form an integral aspect of system forensics and would be discussed in detail. Before moving on to the next slide, hold a brief discussion on why is it important for organizations to take the help of system forensics. The discussion should be focused on: The role that system forensics plays in organizations having an IT set up. This discussion will serve as a precursor to the next slide.