SlideShare a Scribd company logo
Performing Data Updates


Pre-Assessment Questions
   1.   Consider the following statements:
        ā€¢ Statement A: Complex data binding is the process of binding a control.
        ā€¢ Statement B: Simple data binding is the process of binding a
            component.
        Which of the following is correct with respect to the above statements?
        a.  Both, Statement A and Statement B, are False.
        b.   Both, Statement A and Statement B, are True.
        c.   Statement A is True and Statement B is False.
        d.   Statement A is False and Statement B is True.




Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 1 of 25
Performing Data Updates


Pre-Assessment Questions (Contd.)
   2.   Consider the following statements:
        ā€¢ Statement A: When user click the DataSource property of the DataGrid
            control, the drop-down list displays the <dataset.table name> option as
            well as the <dataset name> option.
        ā€¢ Statement B: The CurrencyManager class is derived from the
            BindingManagerBase class.
        Which of the following is correct with respect to the above statements?
        a.  Both, Statement A and Statement B, are False.
        b.   Both, Statement A and Statement B, are True.
        c.   Statement A is True and Statement B is False.
        d.   Statement A is False and Statement B is True.




Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 2 of 25
Performing Data Updates


Pre-Assessment Questions (Contd.)
   3.   Consider the following statements:
        ā€¢ Statement A: By using parameterized queries, data can be filtered
            based on the criterion entered by a user at run time.
        ā€¢ Statement B: Parameterized queries cannot created while configuring
            data adapters.
        Which of the following is correct with respect to the above statements?
        a.  Both, Statement A and Statement B, are False.
        b.   Both, Statement A and Statement B, are True.
        c.   Statement A is True and Statement B is False.
        d.   Statement A is False and Statement B is True.




Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 3 of 25
Performing Data Updates


Pre-Assessment Questions (Contd.)
   4.   Consider the following statements:
        ā€¢ Statement A: Data in a dataset can be filtered using the Select()
            method.
        ā€¢ Statement B: Select method is a member of DataTable class.
        Which of the following is correct with respect to the above statements?
        a.  Both, Statement A and Statement B, are False.
        b.   Both, Statement A and Statement B, are True.
        c.   Statement A is True and Statement B is False.
        d.   Statement A is False and Statement B is True.




Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 4 of 25
Performing Data Updates


Pre-Assessment Questions (Contd.)
   5.   Consider the following statements:
        ā€¢ Statement A: By default, every table in a dataset has a data view
            attached to it.
        ā€¢ Statement B: User cannot create the DataView objects in applications
            explicitly.
        Which of the following is correct with respect to the above statements?
        a.  Both, Statement A and Statement B, are False.
        b.   Both, Statement A and Statement B, are True.
        c.   Statement A is True and Statement B is False.
        d.   Statement A is False and Statement B is True.




Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 5 of 25
Performing Data Updates


Solutions to Pre-Assessment
Questions
        2.   a. Both, Statement A and Statement B, are False.
        3.   b. Both, Statement A and Statement B, are True.
        4.   c. Statement A is True and Statement B is False.
        5.   b. Both, Statement A and Statement B, are True.
        6.   c. Statement A is True and Statement B is False.




Ā©NIIT         Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 6 of 25
Performing Data Updates


Objectives
   In this lesson, you will learn to:
        ā€¢ Implement cached data updates
        ā€¢ Implement direct data updates
        ā€¢ Maintain data concurrency
        ā€¢ Display data from multiple tables in a single Windows Form




Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 7 of 25
Performing Data Updates


Updating Data
   ā€¢    ADO.NET enables Windows Form to display data from the database.
   ā€¢    Data can be retrieved from database using ADO.NET.
   ā€¢    Database also can be updated with the changes user makes using ADO.NET.
   ā€¢    Data can be retrieved from a database directly through data commands or
        cached in datasets.




Ā©NIIT      Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 8 of 25
Performing Data Updates


Cached Data Updates
   ā€¢    The sequence of operations that occur during cached data update are:
          ā€¢ Data from the database is cached in a dataset and presented to a user
            through an application.
          ā€¢ The user updates the data, that is, adds, deletes, or modifies the data
            through the application.
          ā€¢ The dataset is updated with the changes that the user makes through the
            application.
          ā€¢ The changes in the dataset are transferred to the database at the back
            end.
   ā€¢    Updating the database consists of two steps, updating the dataset and
        updating the database.




Ā©NIIT        Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 9 of 25
Performing Data Updates


Updating a Dataset
   ā€¢    A dataset can be updated by using their collections, their objects, and their
        methods.
   ā€¢    When user make changes to a record in the table, some events are raised by
        the DataTable object that are as follows:
          ā€¢ ColumnChanging event
          ā€¢ RowChanging event
          ā€¢ ColumnChanged event
          ā€¢ RowChanged event
          ā€¢ RowDeleting event
          ā€¢ RowDeleted event




Ā©NIIT         Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 10 of 25
Performing Data Updates


Using Events to Validate the Data in a
Dataset
   ā€¢    The ColumnChanging and RowChanging events
   ā€¢    The ColumnChanging event.
   ā€¢    The RowChanging event.
   ā€¢    The Row property.
   ā€¢    Column property
   ā€¢    The Row and Column properties
   ā€¢    The data adapter needs information regarding each change in the dataset to
        update the data source.




Ā©NIIT        Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 11 of 25
Performing Data Updates


Using Events to Validate the Data in a
Dataset (Contd.)
   ā€¢    Dataset has to be maintain some information while making changes to dataset.
        This is as given below:
          ā€¢ The RowState property
          ā€¢ The DataRowVersion enumeration
   ā€¢    Call the AcceptChanges() method of the dataset to accept the changes.
   ā€¢    When the AcceptChanges() method is called, it overwrites the original version
        of a record with the current version.




Ā©NIIT        Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 12 of 25
Performing Data Updates


Updating a Data Source
   ā€¢    The data source is updated with the changed dataset by calling the Update()
        method of the data adapter.
   ā€¢    The data adapter uses the RowState property and the DataRowVersion
        enumeration information of the DataRow object to make the changes in the
        data source.




Ā©NIIT         Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 13 of 25
Performing Data Updates


Direct Data Updates
   ā€¢    Data source also can be accessed directly through data. Data commands are
        generally used in the following cases:
          ā€¢ To work with stored procedures that return a result set, which can be
            manipulated.
          ā€¢ To access data that is not appropriate for storing in a dataset, such as
            data with a short life cycle.
          ā€¢ To access read-only data, that is, data that will not be updated.
   ā€¢    For executing a data command, the Connection, CommandText, and the
        Parameters properties for the data command have to be set.
   ā€¢    Connection property is set for specifying the connection.
   ā€¢    CommandText property is set for the SQL query or the stored procedure to be
        executed to retrieve the data.
   ā€¢    Parameters property is set for the parameters for the execution of the
        command.



Ā©NIIT        Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 14 of 25
Performing Data Updates




                        Demo
                   Maintaining Data




Ā©NIIT   Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 15 of 25
Performing Data Updates


Problem Statement
   ā€¢    The Diaz Telecommunications Sales Manager needs to view the customer
        details in a customized format. In addition, the customer details need to be
        maintained, which involves adding new customer details, and modifying and
        deleting the existing ones.




Ā©NIIT         Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 16 of 25
Performing Data Updates


Solution
   ā€¢    To maintain customer details, you need to perform the following steps:
        1.  Design a Windows Form to update the data.
        2.  Connect to the database.
        3.  Bind the data to the Windows Forms Controls.
        4.  Write the code to update the data.
        5.  Perform data maintenance




Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 17 of 25
Performing Data Updates


Maintaining Data Concurrency
   ā€¢    When many people attempt to modify data in a database at the same time, a
        system of controls must be implemented so that modifications made by one
        person do not adversely affect those of another person, this is called
        concurrency control.
   ā€¢    There are three types of concurrency controls:
          ā€¢ Pessimistic concurrency control
          ā€¢ Optimistic concurrency control
          ā€¢ ā€˜Last in Winsā€™ concurrency control
   ā€¢    ADO.NET implements optimistic concurrency by using two methods Version
        Number Method and Saving All Values Method.




Ā©NIIT        Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 18 of 25
Performing Data Updates


Optimistic Concurrency through Data
Adapters
   ā€¢    To ensure that a data adapter, when configured, implements optimistic
        concurrency, perform the following steps:
        ā€¢ Drag an OleDbDataAdapter object into the Windows Form.
        ā€¢ Data Adapter Configuration Wizard starts. On the third screen of
             the wizard, ensure that the Use SQL statements option is selected.
        ā€¢ On the fourth screen, click the Query Builder button to create a query
             for retrieving data. Select a table and its fields to be displayed.
        ā€¢ After the table and its fields are selected, click the OK button.
        ā€¢ Click the Advanced Options button.
        ā€¢ The Use optimistic concurrency check box is selected by default.
        ā€¢ Click the OK button. Then, click the Next button. The SQL statements
             for retrieving the data are generated.
        ā€¢ Click the Finish button to create a data adapter.
Ā©NIIT      Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 19 of 25
Performing Data Updates


Displaying Data From Multiple Tables
    ā€¢   Data can be displayed from two different tables, using relationship. To
        display data from two tables perform the following tasks:
        ā€¢ Design a Windows Form to display data.
        ā€¢ Connect to the database.
        ā€¢ Generate a dataset for the created data adapters.
        ā€¢ Create a relationship between the tables.
        ā€¢ From the Solution Explorer window, select the XML schema for the
             dataset that has been created.
        ā€¢ Double-click the schema dsMasterDetails.xsd to view its structure.
             The dataset structure is displayed.
        ā€¢ Select View from the menu bar. Then, select Toolbox from the View
             menu. The Toolbox is displayed on the left pane of the screen. Select
             the XML Schema tab of the Toolbox.



Ā©NIIT     Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 20 of 25
Performing Data Updates


Displaying Data From Multiple Tables
(Contd.)
    ā€¢   Drag a Relation control from the XML Schema tab of the Toolbox to an
        table of the dataset. The Edit Relation dialog box is displayed. By default,
        the name of the relationship is <parent table name child table name>.
    ā€¢   Set the Parent element, Child element, Key Fields, and Foreign Key
        Fields values in the Edit Relation dialog box and click the OK button.
    ā€¢   A Relation icon appears between the two tables, depicting a relationship
        between them. You can modify the relationship by right-clicking the
        Relation icon and choosing the Edit Relation option from the shortcut
        menu.
    ā€¢   Bind the data to the Windows Form controls.
    ā€¢   Name the DataGrid control and bind it by setting the DataSource property
        and the DataMember property.
    ā€¢    Bind the control on forms and write code to fill dataset on load event of
        form.
Ā©NIIT     Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 21 of 25
Performing Data Updates


Using Stored Procedures
   ā€¢    Stored procedures are used for encapsulating database operations in a single
        command.
   ā€¢    The ADO.NET Command object provides the Parameters collection for calling
        a stored procedure.
   ā€¢    To call a stored procedure, you need to pass the stored procedure name
        followed by parameter arguments as an SQL statement.




Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 22 of 25
Performing Data Updates


Summary
   In this lesson, you learned that:
   ā€¢ ADO.NET enables you to display data from the database in a Windows Form.
        The sequence of operations that occur during cached data update is:
        ā€¢ The dataset is updated with the changes that the user makes through
              the application. At this point, database remains unaffected, as the
              changes are made only in the dataset cache.
        ā€¢ The user updates the data, that is, adds, deletes, or modifies the data
              through the application.
        ā€¢ The dataset is updated with the changes that the user makes through
              the application.
        ā€¢ The changes in the dataset are transferred to the database at the back
              end.
   ā€¢ A dataset can be updated by using these collections, their objects, and their
        methods.



Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 23 of 25
Performing Data Updates


Summary (Contd.)
   ā€¢    The Rows collection of a DataSet class contains rows of data in a DataRow
        object.
   ā€¢    The ColumnChanging and RowChanging events raised by the DataTable
        object are used to validate the values being entered in the dataset while
        updating the dataset.
   ā€¢    The RowState property of the DataRow object indicates the current state of
        the record.
   ā€¢    The data source is updated with the changed dataset by calling the Update()
        method of the data adapter.
   ā€¢    Data commands can be used in the following cases:
        ā€¢ To work with stored procedures that return a result set
        ā€¢ To access data that is not appropriate for storing in a dataset



Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 24 of 25
Performing Data Updates


Summary (Contd.)
   ā€¢    To access read-only data, that is, data that will not be updated.
   ā€¢    The version number method requires the record to be updated to have a
        datetime stamp or a version number column.
   ā€¢    By default, the data adapters that are created in an application implement
        optimistic concurrency.
   ā€¢    Tables are stored in a dataset as discrete entities but a relationship can be
        created between the stored tables to display data from the related tables.
   ā€¢    You can use stored procedures for encapsulating database operations in a
        single command.
   ā€¢    The ADO.NET Command object provides the Parameters collection for calling
        a stored procedure.




Ā©NIIT       Creating Data Centric Application Using ADO.NET   Lesson 2A / Slide 25 of 25

More Related Content

Viewers also liked

La tecnologia jesica arbelaez
La tecnologia jesica arbelaezLa tecnologia jesica arbelaez
La tecnologia jesica arbelaez
dayayyessi530
Ā 
Ecologia
EcologiaEcologia
Ecologia
David ZuƱiga
Ā 
altiplano
altiplanoaltiplano
Galileo iClinic e ADI 360, da oggi disponibili anche su Windows 8
Galileo iClinic e ADI 360, da oggi disponibili anche su Windows 8Galileo iClinic e ADI 360, da oggi disponibili anche su Windows 8
Galileo iClinic e ADI 360, da oggi disponibili anche su Windows 8
Maria Beatrice Fasano
Ā 
50 palabras y su significado
50 palabras y su significado50 palabras y su significado
50 palabras y su significado
Iris MƔrquez
Ā 
Origenes estadĆ­stica
Origenes estadĆ­sticaOrigenes estadĆ­stica
Origenes estadĆ­stica
presentacionestmh2013
Ā 
Beam engine
Beam engineBeam engine
Beam engine
Kavinder singh
Ā 
soal ujian kompetensi Tkj 2013
soal ujian kompetensi Tkj 2013soal ujian kompetensi Tkj 2013
soal ujian kompetensi Tkj 2013heri baskoro
Ā 
Guia prĆ”tico para quebra de dormĆŖncia de sementes florestais de espĆ©cies nat...
 Guia prĆ”tico para quebra de dormĆŖncia de sementes florestais de espĆ©cies nat... Guia prĆ”tico para quebra de dormĆŖncia de sementes florestais de espĆ©cies nat...
Guia prĆ”tico para quebra de dormĆŖncia de sementes florestais de espĆ©cies nat...
Rural PecuƔria
Ā 
DaƱos causados por Hormigas Cortadoras (GƩneros Atta y Acromyrmex)
DaƱos causados porHormigas Cortadoras (GƩneros Atta y Acromyrmex) DaƱos causados porHormigas Cortadoras (GƩneros Atta y Acromyrmex)
DaƱos causados por Hormigas Cortadoras (GƩneros Atta y Acromyrmex)
JOSE YVANOSKY VAZQUEZ CHACON
Ā 
FOUR BAR CHAIN AND INVERSIONS
FOUR BAR CHAIN AND INVERSIONSFOUR BAR CHAIN AND INVERSIONS
FOUR BAR CHAIN AND INVERSIONS
saahil kshatriya
Ā 
Tecidos vegetais
Tecidos vegetaisTecidos vegetais
Tecidos vegetais
turma21
Ā 

Viewers also liked (13)

La tecnologia jesica arbelaez
La tecnologia jesica arbelaezLa tecnologia jesica arbelaez
La tecnologia jesica arbelaez
Ā 
Ecologia
EcologiaEcologia
Ecologia
Ā 
altiplano
altiplanoaltiplano
altiplano
Ā 
02
0202
02
Ā 
Galileo iClinic e ADI 360, da oggi disponibili anche su Windows 8
Galileo iClinic e ADI 360, da oggi disponibili anche su Windows 8Galileo iClinic e ADI 360, da oggi disponibili anche su Windows 8
Galileo iClinic e ADI 360, da oggi disponibili anche su Windows 8
Ā 
50 palabras y su significado
50 palabras y su significado50 palabras y su significado
50 palabras y su significado
Ā 
Origenes estadĆ­stica
Origenes estadĆ­sticaOrigenes estadĆ­stica
Origenes estadĆ­stica
Ā 
Beam engine
Beam engineBeam engine
Beam engine
Ā 
soal ujian kompetensi Tkj 2013
soal ujian kompetensi Tkj 2013soal ujian kompetensi Tkj 2013
soal ujian kompetensi Tkj 2013
Ā 
Guia prĆ”tico para quebra de dormĆŖncia de sementes florestais de espĆ©cies nat...
 Guia prĆ”tico para quebra de dormĆŖncia de sementes florestais de espĆ©cies nat... Guia prĆ”tico para quebra de dormĆŖncia de sementes florestais de espĆ©cies nat...
Guia prĆ”tico para quebra de dormĆŖncia de sementes florestais de espĆ©cies nat...
Ā 
DaƱos causados por Hormigas Cortadoras (GƩneros Atta y Acromyrmex)
DaƱos causados porHormigas Cortadoras (GƩneros Atta y Acromyrmex) DaƱos causados porHormigas Cortadoras (GƩneros Atta y Acromyrmex)
DaƱos causados por Hormigas Cortadoras (GƩneros Atta y Acromyrmex)
Ā 
FOUR BAR CHAIN AND INVERSIONS
FOUR BAR CHAIN AND INVERSIONSFOUR BAR CHAIN AND INVERSIONS
FOUR BAR CHAIN AND INVERSIONS
Ā 
Tecidos vegetais
Tecidos vegetaisTecidos vegetais
Tecidos vegetais
Ā 

Similar to Vb.net session 07

Vb.net session 08
Vb.net session 08Vb.net session 08
Vb.net session 08
Niit Care
Ā 
Vb.net session 06
Vb.net session 06Vb.net session 06
Vb.net session 06
Niit Care
Ā 
Vb net xp_07
Vb net xp_07Vb net xp_07
Vb net xp_07
Niit Care
Ā 
Designing Database Solutions for Microsoft SQL Server 2012 2012 Microsoft 70-...
Designing Database Solutions for Microsoft SQL Server 2012 2012 Microsoft 70-...Designing Database Solutions for Microsoft SQL Server 2012 2012 Microsoft 70-...
Designing Database Solutions for Microsoft SQL Server 2012 2012 Microsoft 70-...
ChristopherBow2
Ā 
Day 8.1 system_admin_tasks
Day 8.1 system_admin_tasksDay 8.1 system_admin_tasks
Day 8.1 system_admin_tasks
tovetrivel
Ā 
Vb.net session 05
Vb.net session 05Vb.net session 05
Vb.net session 05
Niit Care
Ā 
Ado.net session01
Ado.net session01Ado.net session01
Ado.net session01
Niit Care
Ā 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
Mani Chaubey
Ā 
Crystal report
Crystal reportCrystal report
Databind in asp.net
Databind in asp.netDatabind in asp.net
Databind in asp.net
Sireesh K
Ā 
Work with data in ASP.NET
Work with data in ASP.NETWork with data in ASP.NET
Work with data in ASP.NET
Peter Gfader
Ā 
SCWCD : Web tier design CHAP : 11
SCWCD : Web tier design CHAP : 11SCWCD : Web tier design CHAP : 11
SCWCD : Web tier design CHAP : 11
Ben Abdallah Helmi
Ā 
IT 505 Final Submission Operating System Upgrade Implementation Brief
IT 505 Final Submission Operating System Upgrade Implementation BriefIT 505 Final Submission Operating System Upgrade Implementation Brief
IT 505 Final Submission Operating System Upgrade Implementation Brief
EmmaDrinmk
Ā 
Innovize it for_db2_empowering the dba_april_2016
Innovize it for_db2_empowering the dba_april_2016Innovize it for_db2_empowering the dba_april_2016
Innovize it for_db2_empowering the dba_april_2016
Eliezer Harkavi
Ā 
Oracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and AnswersOracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and Answers
douglascarnicelli
Ā 
Connect 2014 - CUST109 - planning and upgrading to ibm connections 4.5 succes...
Connect 2014 - CUST109 - planning and upgrading to ibm connections 4.5 succes...Connect 2014 - CUST109 - planning and upgrading to ibm connections 4.5 succes...
Connect 2014 - CUST109 - planning and upgrading to ibm connections 4.5 succes...
Martin Schmidt
Ā 
4 h0 002
4 h0 0024 h0 002
4 h0 002
markuauyl
Ā 
Databricks Data Analyst Associate Exam Dumps 2024.pdf
Databricks Data Analyst Associate Exam Dumps 2024.pdfDatabricks Data Analyst Associate Exam Dumps 2024.pdf
Databricks Data Analyst Associate Exam Dumps 2024.pdf
SkillCertProExams
Ā 
Sql portfolio admin_practicals
Sql portfolio admin_practicalsSql portfolio admin_practicals
Sql portfolio admin_practicals
Shelli Ciaschini
Ā 
Vb net xp_06
Vb net xp_06Vb net xp_06
Vb net xp_06
Niit Care
Ā 

Similar to Vb.net session 07 (20)

Vb.net session 08
Vb.net session 08Vb.net session 08
Vb.net session 08
Ā 
Vb.net session 06
Vb.net session 06Vb.net session 06
Vb.net session 06
Ā 
Vb net xp_07
Vb net xp_07Vb net xp_07
Vb net xp_07
Ā 
Designing Database Solutions for Microsoft SQL Server 2012 2012 Microsoft 70-...
Designing Database Solutions for Microsoft SQL Server 2012 2012 Microsoft 70-...Designing Database Solutions for Microsoft SQL Server 2012 2012 Microsoft 70-...
Designing Database Solutions for Microsoft SQL Server 2012 2012 Microsoft 70-...
Ā 
Day 8.1 system_admin_tasks
Day 8.1 system_admin_tasksDay 8.1 system_admin_tasks
Day 8.1 system_admin_tasks
Ā 
Vb.net session 05
Vb.net session 05Vb.net session 05
Vb.net session 05
Ā 
Ado.net session01
Ado.net session01Ado.net session01
Ado.net session01
Ā 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
Ā 
Crystal report
Crystal reportCrystal report
Crystal report
Ā 
Databind in asp.net
Databind in asp.netDatabind in asp.net
Databind in asp.net
Ā 
Work with data in ASP.NET
Work with data in ASP.NETWork with data in ASP.NET
Work with data in ASP.NET
Ā 
SCWCD : Web tier design CHAP : 11
SCWCD : Web tier design CHAP : 11SCWCD : Web tier design CHAP : 11
SCWCD : Web tier design CHAP : 11
Ā 
IT 505 Final Submission Operating System Upgrade Implementation Brief
IT 505 Final Submission Operating System Upgrade Implementation BriefIT 505 Final Submission Operating System Upgrade Implementation Brief
IT 505 Final Submission Operating System Upgrade Implementation Brief
Ā 
Innovize it for_db2_empowering the dba_april_2016
Innovize it for_db2_empowering the dba_april_2016Innovize it for_db2_empowering the dba_april_2016
Innovize it for_db2_empowering the dba_april_2016
Ā 
Oracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and AnswersOracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and Answers
Ā 
Connect 2014 - CUST109 - planning and upgrading to ibm connections 4.5 succes...
Connect 2014 - CUST109 - planning and upgrading to ibm connections 4.5 succes...Connect 2014 - CUST109 - planning and upgrading to ibm connections 4.5 succes...
Connect 2014 - CUST109 - planning and upgrading to ibm connections 4.5 succes...
Ā 
4 h0 002
4 h0 0024 h0 002
4 h0 002
Ā 
Databricks Data Analyst Associate Exam Dumps 2024.pdf
Databricks Data Analyst Associate Exam Dumps 2024.pdfDatabricks Data Analyst Associate Exam Dumps 2024.pdf
Databricks Data Analyst Associate Exam Dumps 2024.pdf
Ā 
Sql portfolio admin_practicals
Sql portfolio admin_practicalsSql portfolio admin_practicals
Sql portfolio admin_practicals
Ā 
Vb net xp_06
Vb net xp_06Vb net xp_06
Vb net xp_06
Ā 

More from Niit Care

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

More from 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
Ā 

Recently uploaded

The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
Ā 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
Ā 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
Vadym Kazulkin
Ā 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
Ā 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
Ā 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
Ā 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
Ā 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
Ā 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
Ā 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
Ā 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
Ā 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
Ā 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
Ā 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
Ā 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
Ā 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
Ā 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
Ā 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
Ā 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
Ā 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
Ā 

Recently uploaded (20)

The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
Ā 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Ā 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
Ā 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
Ā 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Ā 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Ā 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Ā 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Ā 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Ā 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Ā 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Ā 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
Ā 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
Ā 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Ā 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Ā 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Ā 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Ā 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Ā 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
Ā 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
Ā 

Vb.net session 07

  • 1. Performing Data Updates Pre-Assessment Questions 1. Consider the following statements: ā€¢ Statement A: Complex data binding is the process of binding a control. ā€¢ Statement B: Simple data binding is the process of binding a component. Which of the following is correct with respect to the above statements? a. Both, Statement A and Statement B, are False. b. Both, Statement A and Statement B, are True. c. Statement A is True and Statement B is False. d. Statement A is False and Statement B is True. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 1 of 25
  • 2. Performing Data Updates Pre-Assessment Questions (Contd.) 2. Consider the following statements: ā€¢ Statement A: When user click the DataSource property of the DataGrid control, the drop-down list displays the <dataset.table name> option as well as the <dataset name> option. ā€¢ Statement B: The CurrencyManager class is derived from the BindingManagerBase class. Which of the following is correct with respect to the above statements? a. Both, Statement A and Statement B, are False. b. Both, Statement A and Statement B, are True. c. Statement A is True and Statement B is False. d. Statement A is False and Statement B is True. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 2 of 25
  • 3. Performing Data Updates Pre-Assessment Questions (Contd.) 3. Consider the following statements: ā€¢ Statement A: By using parameterized queries, data can be filtered based on the criterion entered by a user at run time. ā€¢ Statement B: Parameterized queries cannot created while configuring data adapters. Which of the following is correct with respect to the above statements? a. Both, Statement A and Statement B, are False. b. Both, Statement A and Statement B, are True. c. Statement A is True and Statement B is False. d. Statement A is False and Statement B is True. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 3 of 25
  • 4. Performing Data Updates Pre-Assessment Questions (Contd.) 4. Consider the following statements: ā€¢ Statement A: Data in a dataset can be filtered using the Select() method. ā€¢ Statement B: Select method is a member of DataTable class. Which of the following is correct with respect to the above statements? a. Both, Statement A and Statement B, are False. b. Both, Statement A and Statement B, are True. c. Statement A is True and Statement B is False. d. Statement A is False and Statement B is True. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 4 of 25
  • 5. Performing Data Updates Pre-Assessment Questions (Contd.) 5. Consider the following statements: ā€¢ Statement A: By default, every table in a dataset has a data view attached to it. ā€¢ Statement B: User cannot create the DataView objects in applications explicitly. Which of the following is correct with respect to the above statements? a. Both, Statement A and Statement B, are False. b. Both, Statement A and Statement B, are True. c. Statement A is True and Statement B is False. d. Statement A is False and Statement B is True. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 5 of 25
  • 6. Performing Data Updates Solutions to Pre-Assessment Questions 2. a. Both, Statement A and Statement B, are False. 3. b. Both, Statement A and Statement B, are True. 4. c. Statement A is True and Statement B is False. 5. b. Both, Statement A and Statement B, are True. 6. c. Statement A is True and Statement B is False. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 6 of 25
  • 7. Performing Data Updates Objectives In this lesson, you will learn to: ā€¢ Implement cached data updates ā€¢ Implement direct data updates ā€¢ Maintain data concurrency ā€¢ Display data from multiple tables in a single Windows Form Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 7 of 25
  • 8. Performing Data Updates Updating Data ā€¢ ADO.NET enables Windows Form to display data from the database. ā€¢ Data can be retrieved from database using ADO.NET. ā€¢ Database also can be updated with the changes user makes using ADO.NET. ā€¢ Data can be retrieved from a database directly through data commands or cached in datasets. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 8 of 25
  • 9. Performing Data Updates Cached Data Updates ā€¢ The sequence of operations that occur during cached data update are: ā€¢ Data from the database is cached in a dataset and presented to a user through an application. ā€¢ The user updates the data, that is, adds, deletes, or modifies the data through the application. ā€¢ The dataset is updated with the changes that the user makes through the application. ā€¢ The changes in the dataset are transferred to the database at the back end. ā€¢ Updating the database consists of two steps, updating the dataset and updating the database. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 9 of 25
  • 10. Performing Data Updates Updating a Dataset ā€¢ A dataset can be updated by using their collections, their objects, and their methods. ā€¢ When user make changes to a record in the table, some events are raised by the DataTable object that are as follows: ā€¢ ColumnChanging event ā€¢ RowChanging event ā€¢ ColumnChanged event ā€¢ RowChanged event ā€¢ RowDeleting event ā€¢ RowDeleted event Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 10 of 25
  • 11. Performing Data Updates Using Events to Validate the Data in a Dataset ā€¢ The ColumnChanging and RowChanging events ā€¢ The ColumnChanging event. ā€¢ The RowChanging event. ā€¢ The Row property. ā€¢ Column property ā€¢ The Row and Column properties ā€¢ The data adapter needs information regarding each change in the dataset to update the data source. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 11 of 25
  • 12. Performing Data Updates Using Events to Validate the Data in a Dataset (Contd.) ā€¢ Dataset has to be maintain some information while making changes to dataset. This is as given below: ā€¢ The RowState property ā€¢ The DataRowVersion enumeration ā€¢ Call the AcceptChanges() method of the dataset to accept the changes. ā€¢ When the AcceptChanges() method is called, it overwrites the original version of a record with the current version. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 12 of 25
  • 13. Performing Data Updates Updating a Data Source ā€¢ The data source is updated with the changed dataset by calling the Update() method of the data adapter. ā€¢ The data adapter uses the RowState property and the DataRowVersion enumeration information of the DataRow object to make the changes in the data source. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 13 of 25
  • 14. Performing Data Updates Direct Data Updates ā€¢ Data source also can be accessed directly through data. Data commands are generally used in the following cases: ā€¢ To work with stored procedures that return a result set, which can be manipulated. ā€¢ To access data that is not appropriate for storing in a dataset, such as data with a short life cycle. ā€¢ To access read-only data, that is, data that will not be updated. ā€¢ For executing a data command, the Connection, CommandText, and the Parameters properties for the data command have to be set. ā€¢ Connection property is set for specifying the connection. ā€¢ CommandText property is set for the SQL query or the stored procedure to be executed to retrieve the data. ā€¢ Parameters property is set for the parameters for the execution of the command. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 14 of 25
  • 15. Performing Data Updates Demo Maintaining Data Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 15 of 25
  • 16. Performing Data Updates Problem Statement ā€¢ The Diaz Telecommunications Sales Manager needs to view the customer details in a customized format. In addition, the customer details need to be maintained, which involves adding new customer details, and modifying and deleting the existing ones. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 16 of 25
  • 17. Performing Data Updates Solution ā€¢ To maintain customer details, you need to perform the following steps: 1. Design a Windows Form to update the data. 2. Connect to the database. 3. Bind the data to the Windows Forms Controls. 4. Write the code to update the data. 5. Perform data maintenance Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 17 of 25
  • 18. Performing Data Updates Maintaining Data Concurrency ā€¢ When many people attempt to modify data in a database at the same time, a system of controls must be implemented so that modifications made by one person do not adversely affect those of another person, this is called concurrency control. ā€¢ There are three types of concurrency controls: ā€¢ Pessimistic concurrency control ā€¢ Optimistic concurrency control ā€¢ ā€˜Last in Winsā€™ concurrency control ā€¢ ADO.NET implements optimistic concurrency by using two methods Version Number Method and Saving All Values Method. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 18 of 25
  • 19. Performing Data Updates Optimistic Concurrency through Data Adapters ā€¢ To ensure that a data adapter, when configured, implements optimistic concurrency, perform the following steps: ā€¢ Drag an OleDbDataAdapter object into the Windows Form. ā€¢ Data Adapter Configuration Wizard starts. On the third screen of the wizard, ensure that the Use SQL statements option is selected. ā€¢ On the fourth screen, click the Query Builder button to create a query for retrieving data. Select a table and its fields to be displayed. ā€¢ After the table and its fields are selected, click the OK button. ā€¢ Click the Advanced Options button. ā€¢ The Use optimistic concurrency check box is selected by default. ā€¢ Click the OK button. Then, click the Next button. The SQL statements for retrieving the data are generated. ā€¢ Click the Finish button to create a data adapter. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 19 of 25
  • 20. Performing Data Updates Displaying Data From Multiple Tables ā€¢ Data can be displayed from two different tables, using relationship. To display data from two tables perform the following tasks: ā€¢ Design a Windows Form to display data. ā€¢ Connect to the database. ā€¢ Generate a dataset for the created data adapters. ā€¢ Create a relationship between the tables. ā€¢ From the Solution Explorer window, select the XML schema for the dataset that has been created. ā€¢ Double-click the schema dsMasterDetails.xsd to view its structure. The dataset structure is displayed. ā€¢ Select View from the menu bar. Then, select Toolbox from the View menu. The Toolbox is displayed on the left pane of the screen. Select the XML Schema tab of the Toolbox. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 20 of 25
  • 21. Performing Data Updates Displaying Data From Multiple Tables (Contd.) ā€¢ Drag a Relation control from the XML Schema tab of the Toolbox to an table of the dataset. The Edit Relation dialog box is displayed. By default, the name of the relationship is <parent table name child table name>. ā€¢ Set the Parent element, Child element, Key Fields, and Foreign Key Fields values in the Edit Relation dialog box and click the OK button. ā€¢ A Relation icon appears between the two tables, depicting a relationship between them. You can modify the relationship by right-clicking the Relation icon and choosing the Edit Relation option from the shortcut menu. ā€¢ Bind the data to the Windows Form controls. ā€¢ Name the DataGrid control and bind it by setting the DataSource property and the DataMember property. ā€¢ Bind the control on forms and write code to fill dataset on load event of form. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 21 of 25
  • 22. Performing Data Updates Using Stored Procedures ā€¢ Stored procedures are used for encapsulating database operations in a single command. ā€¢ The ADO.NET Command object provides the Parameters collection for calling a stored procedure. ā€¢ To call a stored procedure, you need to pass the stored procedure name followed by parameter arguments as an SQL statement. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 22 of 25
  • 23. Performing Data Updates Summary In this lesson, you learned that: ā€¢ ADO.NET enables you to display data from the database in a Windows Form. The sequence of operations that occur during cached data update is: ā€¢ The dataset is updated with the changes that the user makes through the application. At this point, database remains unaffected, as the changes are made only in the dataset cache. ā€¢ The user updates the data, that is, adds, deletes, or modifies the data through the application. ā€¢ The dataset is updated with the changes that the user makes through the application. ā€¢ The changes in the dataset are transferred to the database at the back end. ā€¢ A dataset can be updated by using these collections, their objects, and their methods. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 23 of 25
  • 24. Performing Data Updates Summary (Contd.) ā€¢ The Rows collection of a DataSet class contains rows of data in a DataRow object. ā€¢ The ColumnChanging and RowChanging events raised by the DataTable object are used to validate the values being entered in the dataset while updating the dataset. ā€¢ The RowState property of the DataRow object indicates the current state of the record. ā€¢ The data source is updated with the changed dataset by calling the Update() method of the data adapter. ā€¢ Data commands can be used in the following cases: ā€¢ To work with stored procedures that return a result set ā€¢ To access data that is not appropriate for storing in a dataset Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 24 of 25
  • 25. Performing Data Updates Summary (Contd.) ā€¢ To access read-only data, that is, data that will not be updated. ā€¢ The version number method requires the record to be updated to have a datetime stamp or a version number column. ā€¢ By default, the data adapters that are created in an application implement optimistic concurrency. ā€¢ Tables are stored in a dataset as discrete entities but a relationship can be created between the stored tables to display data from the related tables. ā€¢ You can use stored procedures for encapsulating database operations in a single command. ā€¢ The ADO.NET Command object provides the Parameters collection for calling a stored procedure. Ā©NIIT Creating Data Centric Application Using ADO.NET Lesson 2A / Slide 25 of 25