• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Vb.net session 06
 

Vb.net session 06

on

  • 474 views

 

Statistics

Views

Total Views
474
Views on SlideShare
454
Embed Views
20

Actions

Likes
0
Downloads
0
Comments
1

1 Embed 20

http://niitcourseslides.blogspot.in 20

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Inventory Management System Source Code
    http://www.inventoryinvbdotnet.blogspot.com
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Vb.net session 06 Vb.net session 06 Presentation Transcript

    • Accessing and Manipulating DataPre-Assessment Questions 1. Which of the following is the fundamental format for data transfer in ADO.NET. ? • HTML • .doc • .xls • XML • A data provider, which is used to work specifically with Microsoft SQL Server. a. OLE DB data provider b. SQL Server data provider c. Oracle data provider d. ODBC data provider ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 1 of 24 ADO.NET
    • Accessing and Manipulating DataPre-Assessment Questions (Contd.) 1. Which of the following retrieves data from a database into a dataset? • Data Adapter • Data Reader • Data Command • Data Connection 2. Which of the following is not a component of DataTable? • DataRowCollection • DataView • DataRelation • DataColumnCollection ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 2 of 24 ADO.NET
    • Accessing and Manipulating DataPre-Assessment Questions (Contd.) 1. Which of the following is used to navigate to the next row of data in case the command execution returns multiple rows of data? a. Read method b. Close method c. Open method d. NextResult method ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 3 of 24 ADO.NET
    • Accessing and Manipulating DataObjectives In this lesson, you will learn to: • Implement simple data binding • Implement complex data binding • Filter and sort Data ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 4 of 24 ADO.NET
    • Accessing and Manipulating DataSolutions to Pre-AssessmentQuestions 1. d. XML 2. b. SQL Server data provider 3. a. Data Adapter 4. c. DataRelation 5. d. NextResult method ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 5 of 24 ADO.NET
    • Accessing and Manipulating DataIntroducing Data Binding • Data binding is binding data to a control on a Windows Form to be displayed in a customized format. • Data binding is of two types : • Simple data binding • Simple data binding is process of binding a control, such as a text box or a label, to a value in a dataset. • The dataset value can be bound to the control by using the properties of the control. • Complex data binding • Complex binding is the process of binding a component, such as a DataGrid or a ListBox control, to display multiple values for a column from the dataset rows. ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 6 of 24 ADO.NET
    • Accessing and Manipulating DataComplex Data Binding Control Control Description ListBox This control is used to display data for a column from multiple records of a dataset. The DataSource property of the ListBox control is used to set the dataset, and the DisplayMember property of the ListBox control is used to bind the control to a specific column of a table in the dataset. ComboBox This control has two parts, a text box for entering data and a drop-down list for displaying the data. The DataSource property of the ComboBox control is used to set the dataset, and the DisplayMember property of the ComboBox control is used to bind the control to a specific column of a table in the dataset. DataGrid This control can display data from multiple records as well as multiple columns. The DataSource property of the DataGrid control is used to set the dataset, and the DataMember property of the DataGrid control is used to bind the control to a specific table in the dataset. ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 7 of 24 ADO.NET
    • Accessing and Manipulating DataNavigating between Records • For every data source that is bound to a Windows Form control, there exists a CurrencyManager object. • The CurrencyManager object handles the binding to the data source by keeping a pointer to the current item in the record list. • The CurrencyManager class is derived from the BindingManagerBase class. • The figure given below illustrates the relationship between the BindingContext class, CurrencyManager class, and a Windows Form: Windows Form Control 1 Control 2 Control 3 CurrencyManager 1 DATA SOURCE 1 BindingContext object CurrencyManager 2 DATA SOURCE 2 CurrencyManager 3 DATA SOURCE 3 The BindingContext Class, CurrencyManager Class, and Windows Form ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 8 of 24 ADO.NET
    • Accessing and Manipulating Data Demo Implementing Simple Data Binding ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 9 of 24 ADO.NET
    • Accessing and Manipulating DataProblem Statement • An application needs to be created that allows the Marketing Manager of Diaz Telecommunications to view customer details since the new product details are to be sent to all the customers. In addition, the Marketing Manager should be able to navigate through the customer details. The customer details are located in the database at a remote call center. ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 10 of 24 ADO.NET
    • Accessing and Manipulating DataSolution • To design the application, you need to perform the following steps: 1. Design a Windows Form to display the data 2. Connect to the database 3. Write the code for navigating through the data 4. Bind the data to a Windows Form control ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 11 of 24 ADO.NET
    • Accessing and Manipulating Data Demo Implementing Complex Data Binding ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 12 of 24 ADO.NET
    • Accessing and Manipulating DataProblem Statement • An application needs to be created that allows the Marketing Manager of Diaz Telecommunications to view the customer details in a customized format since the new product details are to be sent to all the customers. The customer details are located in the database at a remote call center. ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 13 of 24 ADO.NET
    • Accessing and Manipulating DataSolution • To design the application, you need to perform the following steps: 1. Design a Windows Form to display the data 2. Connect to the database 3. Bind the data to a Windows Form control ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 14 of 24 ADO.NET
    • Accessing and Manipulating DataFiltering and Sorting Data • You filter the data so as to display only the desired records. • You can sort the data to display it in ascending or descending order of a particular column. • There are two methods for displaying filtered data: • Creating parameterized queries • Filtering a dataset ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 15 of 24 ADO.NET
    • Accessing and Manipulating DataCreating Parameterized Queries • By using parameterized queries, data can be filtered based on the criterion entered by a user at run time. • Parameterized queries are created while configuring data adapters. • For example, when configuring an OLEDB data adapter through the wizard, you can specify the parameterized query for displaying data based on the value stored in the state column, as follows: SELECT id, lname, state FROM authordetails WHERE (state =?) • For an SQL data adapter, the syntax for the above given parameterized query will be as follows: SELECT id, lname, state FROM authordetails WHERE (state =@param) ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 16 of 24 ADO.NET
    • Accessing and Manipulating DataFiltering a Dataset • There are two options for filtering the data in a dataset: • Using the Select() method • Filtering a data view • Using the Select() Method • When the Select() method is used to filter data, the order of the records in the table does not change based on the parameter passed. Only the data is presented in a filtered format. • To use the Select() method, an object of the DataTable class has to be created that will call the Select() method. ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 17 of 24 ADO.NET
    • Accessing and Manipulating DataFiltering a Data View • A DataView object creates a fixed customized view of a given DataTable object. • By default, every table in a dataset has a data view attached to it. • You can also explicitly create the DataView objects in applications. • You can bind the controls to the created data view for displaying data according to your needs. • A parameterized class is a collection of classes that have common parameters and is represented by a template. FILTER2 DataView1 Windows Data Table Application DataView2 DataView3 Filter1 Displaying Customized Data Through Data Views ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 18 of 24 ADO.NET
    • Accessing and Manipulating DataFiltering a Data View (Contd.) • The generic steps to add a data view to a Windows Form are as follows: • Drag the DataView control from the Data tab of the Toolbox to the Windows Form. • Set the properties for the data view by using the Properties window. All the properties can be set at design time as well as at run time. • Data view is preferable since you can bind controls to the DataView object in the Form Designer. ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 19 of 24 ADO.NET
    • Accessing and Manipulating Data Demo Implementing Filtering and Sorting Data ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 20 of 24 ADO.NET
    • Accessing and Manipulating DataProblem Statement • An application needs to be created for the Marketing Manager of Diaz Telecommunications to view the order details for a specific invoice to verify the monthly sales report. ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 21 of 24 ADO.NET
    • Accessing and Manipulating DataSolution • To design the application, you need to perform the following steps: 1. Design a Windows Form to display the data 2. Connect to the database, and filter and sort the data 3. Bind the data to a Windows Form control ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 22 of 24 ADO.NET
    • Accessing and Manipulating DataSummary In this lesson, you learned that: • After the data is retrieved from the database, it has to be bound to a Windows Form control to be displayed in a customized format. • Data binding is of two types: • Simple data binding • Complex data binding • Using parameterized queries, the data can be filtered based on the criterion entered by a user. • After the data is retrieved in a dataset, you can filter the data stored in the dataset by: • Using the Select() method • Using DataView objects • A DataView object allows a fixed customized view of a given DataTable object. ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 23 of 24 ADO.NET
    • Accessing and Manipulating DataSummary (Contd.) • A data view manager is a collection of data views and is useful while working with related tables. • A CurrencyManager object handles the binding to the data source by keeping a pointer to the current item in the record list. • A BindingContext object is used to keep track of the existing CurrencyManager objects on a form. ©NIIT Creating Data Centric Applications using Lesson 1B / Slide 24 of 24 ADO.NET