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


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




     Ver. 1.0                      Session 7               Slide 1 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables


                In a disconnected environment, data is stored in datasets
                and manipulations are performed in the datasets.
                After the data has been manipulated in the dataset, the
                changes are updated to the database.
                A dataset is a disconnected, cached set of records that are
                retrieved from a database.
                The dataset acts like a virtual database containing tables,
                rows, and columns.
                The two main types of datasets are:
                   Typed dataset
                   Untyped dataset
                Let us discuss each of these types in detail.



     Ver. 1.0                     Session 7                          Slide 2 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                Typed Dataset:
                 A typed dataset is derived from the DataSet class and has an
                  associated XML schema, which is created at the time of
                  creation of the dataset.
                 The XML schema contains information about the dataset
                  structure such as the tables, columns, and rows.
                 The XML Schema Definition (XSD) language is used to define
                  the elements and attributes of XML documents.
                 The structure of a typed dataset is decided at the time of its
                  creation.
                 When a typed dataset is created, the data commands are
                  generated automatically by using the column names from the
                  data source.




     Ver. 1.0                     Session 7                             Slide 3 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                Untyped Dataset:
                   An untyped dataset does not have any associated XML
                   schema.
                   In an untyped dataset, the tables and columns are represented
                   as collections.
                   Because an XML schema is not created for an untyped
                   dataset, the structure of an untyped dataset is not known
                   during compilation.
                   Untyped datasets find their use in cases where the structure of
                   the schema is not decided during compilation or the data being
                   used does not have a definite structure.




     Ver. 1.0                      Session 7                              Slide 4 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                A dataset has its own object model, as shown in the
                following figure.




     Ver. 1.0                    Session 7                            Slide 5 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                •   A dataset is created with the help of a DataSet object.
                •   The DataSet object is present in a DataSet class and is
                    defined in the System.Data namespace.
                •   The DataSet object contains a collection of DataTable
                    objects, each containing one or more tables.
                •   A DataTable object contains one or more columns, each
                    represented by a DataColumn object.
                •   To add a column to a DataTable, create a DataColumn
                    object and call the Add() method on the Columns
                    collection, which enables you to access the columns in a
                    datatable.




     Ver. 1.0                        Session 7                         Slide 6 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                The following list describes some parameters that can be
                specified for a column:
                   The name of the column
                   The data type of the column
                   Whether the column is read only
                   Whether the column permits null values
                   Whether the value of the column must be different in each row
                   Whether the column is an auto-increment column
                   Whether the column is an expression column




     Ver. 1.0                     Session 7                              Slide 7 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                •   Consider the following code snippet used for adding
                    columns in a DataTable:
                    DataSet ds = new DataSet();                     Creating a DataSet
                                                                    object
                    DataTable dt = ds.Tables.Add();                 Creating a DataTable
                                                                    object
                    dt.Columns.Add(“Store Id”, typeof(string));     Adding columns in a
                                                                    DataTable
                    dt.Columns.Add(“Store Name”, typeof(string));
                    dt.Columns.Add(“Address”, typeof(string));




     Ver. 1.0                         Session 7                               Slide 8 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                •   A DataTable object also has a Rows collection that allows
                    rows to be accessed in a dataset.
                •   The various methods performed on a row by using the
                    DataRow object are:
                       Add()               Appends the row to the end of the table

                       InsertAt()          Inserts the row at a specified position

                       Find()              Accesses a row in a table by its primary key value

                       Select()            Finds rows that match a specified condition
                       Remove()            Removes the specified DataRow object

                       RemoveAt()          Removes the row at a specified position
                       Delete()            Removes a row provisionally from a table




     Ver. 1.0                        Session 7                                           Slide 9 of 23
Developing Database Applications Using ADO.NET and XML
Just a minute


                Which method of the DataRow object accesses a row in a
                table by its primary key value?
                1.   Find()
                2.   Select()
                3.   InsertAt()
                4.   Add()




                Answer:
                1. Find()



     Ver. 1.0                     Session 7                      Slide 10 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                •   In ADO.NET, you can navigate through multiple tables to
                    validate and summarize the data by using the
                    DataRelation object.
                •   By using primary key and foreign key constraints that use a
                    DataRelation object, you can create the relationship
                    between multiple tables.
                •   The primary key is a unique index and ensures the
                    uniqueness of data stored in that table for that particular
                    row.
                •   The foreign key is a constraint on a table that can reference
                    one or more columns in that table.
                •   The table that has a primary key constraint is known as the
                    Parent table, and the table that has a foreign key constraint
                    is known as the Child table.

     Ver. 1.0                         Session 7                          Slide 11 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                A DataSet.Relations property gets the collection of
                relations that link tables and allow navigation from Parent
                tables to Child tables.
                The Rule enumeration indicates the action that occurs
                when a foreign key constraint is enforced.
                The various Rule enumeration values are:
                   Cascade       Deletes or updates the child DataRow object when the parent
                                 DataRow object is deleted or its unique key is changed

                   None          Throws an exception if the parent DataRow object is deleted or
                                 its unique key is changed

                   SetDefault    Sets the foreign key column(s) value to the default value of the
                                 DataColumn object(s), if the parent DataRow object is deleted
                                 or its unique key is changed
                                 Sets the foreign key column(s) value to DbNull, if the parent
                   SetNull
                                 DataRow object is deleted or its unique key is changed



     Ver. 1.0                     Session 7                                         Slide 12 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                •   Sometimes, the data available in one DataSet can be
                    merged with another DataSet. Or, a copy of the
                    DataTable objects can be created so that the user can edit
                    or modify data, which can then be merged back to the
                    original dataset.
                •   The Merge() method is used to combine data from multiple
                    DataSet, DataTable, and DataRow objects.
                •   During merging of data within datasets, the
                    MissingSchemaAction enumeration specifies the action
                    to be taken when the data added to the dataset and the
                    required DataTable or DataColumn is missing.




     Ver. 1.0                        Session 7                        Slide 13 of 23
Developing Database Applications Using ADO.NET and XML
Working with Datasets and Datatables (Contd.)


                The various values of MissingSchemaAction
                enumeration are:
                   Add                     Adds the DataTable and DataColumn
                                           objects to complete the schema

                   AddWithPrimaryKey       Adds the DataTable, DataColumn,
                                           and PrimaryKey objects to complete
                                           the schema
                   Error                   Throws an exception if the DataColumn
                                           does not exist in the DataSet that is
                                           being updated
                   Ignore                  Ignores data that resides in
                                           DataColumns that are not in the
                                           DataSet being updated




     Ver. 1.0                  Session 7                               Slide 14 of 23
Developing Database Applications Using ADO.NET and XML
Working with Dataviews


               •   A dataview provides a dynamic view of data stored in a
                   datatable.
               •   If any data is modified in the datatable, the dataview
                   associated with the datatable will also show the modified
                   data.
                   Let us understand the object model of a dataview.




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


                The following figure shows the object model of a dataview.

                        DataSet Object

                          DataTable Object
                                                                           DataView Object
                                                           DefaultView
                                                                           Default Sort/Filter
                                                                               Criteria



                                                                         DataView Objects
                                              Additional Views

                                                                               Alternative
                                                                            Sort/Filter Criteria




     Ver. 1.0                                Session 7                                             Slide 16 of 23
Developing Database Applications Using ADO.NET and XML
Working with Dataviews (Contd.)


                •   A DataView object creates a fixed customized view of a
                    given DataTable object.
                •   You can create a DataView object to display the data
                    based on a criterion and another DataView object to
                    display the data based on a different criterion.
                •   The following figure shows how customized data is
                    displayed through dataviews.
                                                   Filter3

                                                   Filter2

                                                   Filter1

                                       DataView1
                        Windows                              DataTable
                        Application    DataView2

                                       DataView3




     Ver. 1.0                         Session 7                          Slide 17 of 23
Developing Database Applications Using ADO.NET and XML
Working with Dataviews (Contd.)


                •   A dataview provides a sorted or filtered view of data in a
                    datatable.
                •   Sorting in a DataTable by using a DataView object is
                    done by using the Sort property.
                •   Filtering a DataTable by using the DataView object is
                    done by using the RowFilter and RowStateFilter
                    properties.




     Ver. 1.0                         Session 7                           Slide 18 of 23
Developing Database Applications Using ADO.NET and XML
Just a minute


                Which property of the DataView object returns a subset of
                rows on the basis of the column values?
                1.   FindRows
                2.   RowFilter
                3.   RowStateFilter
                4.   Find




                Answer:
                2. RowFilter



     Ver. 1.0                    Session 7                        Slide 19 of 23
Developing Database Applications Using ADO.NET and XML
Demo: Manipulating Data in a Disconnected Environment


                Problem Statement:
                   Jane, a member of the HR team at Tebisco, needs to store the
                   details of employees who have recently joined the
                   organization. You need to create an application for Jane that
                   will enable her to add and save the details of new employees,
                   and if required, delete records of employees who are no longer
                   working in the organization. The employee code should get
                   automatically generated based on the format in the table. The
                   employee details will be stored in the empdetails table of the
                   HR database.




     Ver. 1.0                     Session 7                              Slide 20 of 23
Developing Database Applications Using ADO.NET and XML
Summary


               In this session, you learned that:
                 A dataset, which is a part of disconnected environment, is a
                  disconnected, cached set of records that are retrieved from a
                  database.
                 The two main types of datasets are:
                    Typed datasets
                    Untyped datasets
                  A typed dataset is derived from the DataSet class and has an
                  associated XML schema, which is created at the time of
                  creation of a dataset.
                  An untyped dataset does not have any associated XML
                  schema. As a result, the structure of an untyped dataset is not
                  known during compilation.




    Ver. 1.0                      Session 7                              Slide 21 of 23
Developing Database Applications Using ADO.NET and XML
Summary (Contd.)


                The DataSet object contains a collection of DataTable
                 objects, each containing one or more tables.
                A DataTable object contains one or more columns, each
                 represented by a DataColumn object.
                A DataTable object also has a Rows collection, which allows
                 rows to be accessed in a dataset. A DataTable object
                 contains one or more rows, each represented by a DataRow
                 object.
                The DataRelation object is used to navigate through
                 multiple tables to validate and summarize the data.
                The primary key and foreign key constraints in a
                 DataRelation object create the relationship between the
                 tables in a schema.




    Ver. 1.0                    Session 7                            Slide 22 of 23
Developing Database Applications Using ADO.NET and XML
Summary (Contd.)


                The Merge() method is used to combine data from multiple
                 DataSet, DataTable, and DataRow objects.
                A dataview, which is a part of the disconnected environment,
                 enables you to create a dynamic view of data stored in a
                 datatable.
                A DataTable can have multiple DataView objects assigned
                 to it, allowing the data to be viewed in different ways without
                 having to re-read from the database.
                Sorting in a DataTable by using the DataView object is done
                 by using the Sort property.
                Filtering in DataTable using DataView object is done by
                 using the RowFilter and RowStateFilter properties.




    Ver. 1.0                     Session 7                             Slide 23 of 23

Más contenido relacionado

La actualidad más candente

Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETFernando G. Guerrero
 
ADO.NET difference faqs compiled- 1
ADO.NET difference  faqs compiled- 1ADO.NET difference  faqs compiled- 1
ADO.NET difference faqs compiled- 1Umar Ali
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to adoHarman Bajwa
 
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
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb netZishan yousaf
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#Michael Heron
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1Mahmoud Ouf
 
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
 
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
 
Graph db as metastore
Graph db as metastoreGraph db as metastore
Graph db as metastoreHaris Khan
 
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
 
Vb net xp_05
Vb net xp_05Vb net xp_05
Vb net xp_05Niit Care
 

La actualidad más candente (20)

Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.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
 
Ado.net
Ado.netAdo.net
Ado.net
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
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
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb net
 
Intake 38 10
Intake 38 10Intake 38 10
Intake 38 10
 
2310 b 09
2310 b 092310 b 09
2310 b 09
 
Unit4
Unit4Unit4
Unit4
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
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
 
Database Connection
Database ConnectionDatabase Connection
Database Connection
 
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
 
Graph db as metastore
Graph db as metastoreGraph db as metastore
Graph db as metastore
 
Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Ado dot net complete meterial (1)
Ado dot net complete meterial (1)
 
Vb net xp_05
Vb net xp_05Vb net xp_05
Vb net xp_05
 

Similar a Ado.net session07

Similar a Ado.net session07 (20)

Ado .net
Ado .netAdo .net
Ado .net
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Ado.net with asp.net
Ado.net with asp.netAdo.net with asp.net
Ado.net with asp.net
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
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
 
Intake 37 10
Intake 37 10Intake 37 10
Intake 37 10
 
Intake 37 linq3
Intake 37 linq3Intake 37 linq3
Intake 37 linq3
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NET
 
Ado.net
Ado.netAdo.net
Ado.net
 
Vb.net session 16
Vb.net session 16Vb.net session 16
Vb.net session 16
 
Ado.net xml data serialization
Ado.net xml data serializationAdo.net xml data serialization
Ado.net xml data serialization
 
ado.net
ado.netado.net
ado.net
 
What is ado .net architecture_.pdf
What is ado .net architecture_.pdfWhat is ado .net architecture_.pdf
What is ado .net architecture_.pdf
 
Dotnet differences compiled -1
Dotnet differences compiled -1Dotnet differences compiled -1
Dotnet differences compiled -1
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desai
 
Introduction to ado.net
Introduction to ado.netIntroduction to ado.net
Introduction to ado.net
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
5.C#
5.C#5.C#
5.C#
 
ADO.net control
ADO.net controlADO.net control
ADO.net control
 

Más de Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
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-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Último

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

Ado.net session07

  • 1. Developing Database Applications Using ADO.NET and XML Objectives In this session, you will learn to: Working in a disconnected environment Ver. 1.0 Session 7 Slide 1 of 23
  • 2. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables In a disconnected environment, data is stored in datasets and manipulations are performed in the datasets. After the data has been manipulated in the dataset, the changes are updated to the database. A dataset is a disconnected, cached set of records that are retrieved from a database. The dataset acts like a virtual database containing tables, rows, and columns. The two main types of datasets are: Typed dataset Untyped dataset Let us discuss each of these types in detail. Ver. 1.0 Session 7 Slide 2 of 23
  • 3. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) Typed Dataset:  A typed dataset is derived from the DataSet class and has an associated XML schema, which is created at the time of creation of the dataset.  The XML schema contains information about the dataset structure such as the tables, columns, and rows.  The XML Schema Definition (XSD) language is used to define the elements and attributes of XML documents.  The structure of a typed dataset is decided at the time of its creation.  When a typed dataset is created, the data commands are generated automatically by using the column names from the data source. Ver. 1.0 Session 7 Slide 3 of 23
  • 4. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) Untyped Dataset: An untyped dataset does not have any associated XML schema. In an untyped dataset, the tables and columns are represented as collections. Because an XML schema is not created for an untyped dataset, the structure of an untyped dataset is not known during compilation. Untyped datasets find their use in cases where the structure of the schema is not decided during compilation or the data being used does not have a definite structure. Ver. 1.0 Session 7 Slide 4 of 23
  • 5. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) A dataset has its own object model, as shown in the following figure. Ver. 1.0 Session 7 Slide 5 of 23
  • 6. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) • A dataset is created with the help of a DataSet object. • The DataSet object is present in a DataSet class and is defined in the System.Data namespace. • The DataSet object contains a collection of DataTable objects, each containing one or more tables. • A DataTable object contains one or more columns, each represented by a DataColumn object. • To add a column to a DataTable, create a DataColumn object and call the Add() method on the Columns collection, which enables you to access the columns in a datatable. Ver. 1.0 Session 7 Slide 6 of 23
  • 7. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) The following list describes some parameters that can be specified for a column: The name of the column The data type of the column Whether the column is read only Whether the column permits null values Whether the value of the column must be different in each row Whether the column is an auto-increment column Whether the column is an expression column Ver. 1.0 Session 7 Slide 7 of 23
  • 8. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) • Consider the following code snippet used for adding columns in a DataTable: DataSet ds = new DataSet(); Creating a DataSet object DataTable dt = ds.Tables.Add(); Creating a DataTable object dt.Columns.Add(“Store Id”, typeof(string)); Adding columns in a DataTable dt.Columns.Add(“Store Name”, typeof(string)); dt.Columns.Add(“Address”, typeof(string)); Ver. 1.0 Session 7 Slide 8 of 23
  • 9. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) • A DataTable object also has a Rows collection that allows rows to be accessed in a dataset. • The various methods performed on a row by using the DataRow object are: Add() Appends the row to the end of the table InsertAt() Inserts the row at a specified position Find() Accesses a row in a table by its primary key value Select() Finds rows that match a specified condition Remove() Removes the specified DataRow object RemoveAt() Removes the row at a specified position Delete() Removes a row provisionally from a table Ver. 1.0 Session 7 Slide 9 of 23
  • 10. Developing Database Applications Using ADO.NET and XML Just a minute Which method of the DataRow object accesses a row in a table by its primary key value? 1. Find() 2. Select() 3. InsertAt() 4. Add() Answer: 1. Find() Ver. 1.0 Session 7 Slide 10 of 23
  • 11. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) • In ADO.NET, you can navigate through multiple tables to validate and summarize the data by using the DataRelation object. • By using primary key and foreign key constraints that use a DataRelation object, you can create the relationship between multiple tables. • The primary key is a unique index and ensures the uniqueness of data stored in that table for that particular row. • The foreign key is a constraint on a table that can reference one or more columns in that table. • The table that has a primary key constraint is known as the Parent table, and the table that has a foreign key constraint is known as the Child table. Ver. 1.0 Session 7 Slide 11 of 23
  • 12. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) A DataSet.Relations property gets the collection of relations that link tables and allow navigation from Parent tables to Child tables. The Rule enumeration indicates the action that occurs when a foreign key constraint is enforced. The various Rule enumeration values are: Cascade Deletes or updates the child DataRow object when the parent DataRow object is deleted or its unique key is changed None Throws an exception if the parent DataRow object is deleted or its unique key is changed SetDefault Sets the foreign key column(s) value to the default value of the DataColumn object(s), if the parent DataRow object is deleted or its unique key is changed Sets the foreign key column(s) value to DbNull, if the parent SetNull DataRow object is deleted or its unique key is changed Ver. 1.0 Session 7 Slide 12 of 23
  • 13. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) • Sometimes, the data available in one DataSet can be merged with another DataSet. Or, a copy of the DataTable objects can be created so that the user can edit or modify data, which can then be merged back to the original dataset. • The Merge() method is used to combine data from multiple DataSet, DataTable, and DataRow objects. • During merging of data within datasets, the MissingSchemaAction enumeration specifies the action to be taken when the data added to the dataset and the required DataTable or DataColumn is missing. Ver. 1.0 Session 7 Slide 13 of 23
  • 14. Developing Database Applications Using ADO.NET and XML Working with Datasets and Datatables (Contd.) The various values of MissingSchemaAction enumeration are: Add Adds the DataTable and DataColumn objects to complete the schema AddWithPrimaryKey Adds the DataTable, DataColumn, and PrimaryKey objects to complete the schema Error Throws an exception if the DataColumn does not exist in the DataSet that is being updated Ignore Ignores data that resides in DataColumns that are not in the DataSet being updated Ver. 1.0 Session 7 Slide 14 of 23
  • 15. Developing Database Applications Using ADO.NET and XML Working with Dataviews • A dataview provides a dynamic view of data stored in a datatable. • If any data is modified in the datatable, the dataview associated with the datatable will also show the modified data. Let us understand the object model of a dataview. Ver. 1.0 Session 7 Slide 15 of 23
  • 16. Developing Database Applications Using ADO.NET and XML Working with Dataviews (Contd.) The following figure shows the object model of a dataview. DataSet Object DataTable Object DataView Object DefaultView Default Sort/Filter Criteria DataView Objects Additional Views Alternative Sort/Filter Criteria Ver. 1.0 Session 7 Slide 16 of 23
  • 17. Developing Database Applications Using ADO.NET and XML Working with Dataviews (Contd.) • A DataView object creates a fixed customized view of a given DataTable object. • You can create a DataView object to display the data based on a criterion and another DataView object to display the data based on a different criterion. • The following figure shows how customized data is displayed through dataviews. Filter3 Filter2 Filter1 DataView1 Windows DataTable Application DataView2 DataView3 Ver. 1.0 Session 7 Slide 17 of 23
  • 18. Developing Database Applications Using ADO.NET and XML Working with Dataviews (Contd.) • A dataview provides a sorted or filtered view of data in a datatable. • Sorting in a DataTable by using a DataView object is done by using the Sort property. • Filtering a DataTable by using the DataView object is done by using the RowFilter and RowStateFilter properties. Ver. 1.0 Session 7 Slide 18 of 23
  • 19. Developing Database Applications Using ADO.NET and XML Just a minute Which property of the DataView object returns a subset of rows on the basis of the column values? 1. FindRows 2. RowFilter 3. RowStateFilter 4. Find Answer: 2. RowFilter Ver. 1.0 Session 7 Slide 19 of 23
  • 20. Developing Database Applications Using ADO.NET and XML Demo: Manipulating Data in a Disconnected Environment Problem Statement: Jane, a member of the HR team at Tebisco, needs to store the details of employees who have recently joined the organization. You need to create an application for Jane that will enable her to add and save the details of new employees, and if required, delete records of employees who are no longer working in the organization. The employee code should get automatically generated based on the format in the table. The employee details will be stored in the empdetails table of the HR database. Ver. 1.0 Session 7 Slide 20 of 23
  • 21. Developing Database Applications Using ADO.NET and XML Summary In this session, you learned that:  A dataset, which is a part of disconnected environment, is a disconnected, cached set of records that are retrieved from a database.  The two main types of datasets are:  Typed datasets  Untyped datasets A typed dataset is derived from the DataSet class and has an associated XML schema, which is created at the time of creation of a dataset. An untyped dataset does not have any associated XML schema. As a result, the structure of an untyped dataset is not known during compilation. Ver. 1.0 Session 7 Slide 21 of 23
  • 22. Developing Database Applications Using ADO.NET and XML Summary (Contd.)  The DataSet object contains a collection of DataTable objects, each containing one or more tables.  A DataTable object contains one or more columns, each represented by a DataColumn object.  A DataTable object also has a Rows collection, which allows rows to be accessed in a dataset. A DataTable object contains one or more rows, each represented by a DataRow object.  The DataRelation object is used to navigate through multiple tables to validate and summarize the data.  The primary key and foreign key constraints in a DataRelation object create the relationship between the tables in a schema. Ver. 1.0 Session 7 Slide 22 of 23
  • 23. Developing Database Applications Using ADO.NET and XML Summary (Contd.)  The Merge() method is used to combine data from multiple DataSet, DataTable, and DataRow objects.  A dataview, which is a part of the disconnected environment, enables you to create a dynamic view of data stored in a datatable.  A DataTable can have multiple DataView objects assigned to it, allowing the data to be viewed in different ways without having to re-read from the database.  Sorting in a DataTable by using the DataView object is done by using the Sort property.  Filtering in DataTable using DataView object is done by using the RowFilter and RowStateFilter properties. Ver. 1.0 Session 7 Slide 23 of 23

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. 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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. 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.
  18. 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.
  19. 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.
  20. 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.