Presentation is loading. Please wait.

Presentation is loading. Please wait.

New Perspectives on XML, 2nd Edition Tutorial 9B1 USING XML AS A DATA SOURCE TUTORIAL 9B.

Similar presentations


Presentation on theme: "New Perspectives on XML, 2nd Edition Tutorial 9B1 USING XML AS A DATA SOURCE TUTORIAL 9B."— Presentation transcript:

1 New Perspectives on XML, 2nd Edition Tutorial 9B1 USING XML AS A DATA SOURCE TUTORIAL 9B

2 New Perspectives on XML, 2nd Edition Tutorial 9B2 THE DATA SOURCE OBJECT ActiveX Data Objects (ADO) is a data-access technology developed by Microsoft. ADO allows you to work with the Data Source Object by applying a method or by changing one of the properties of the DSO. The syntax for applying a method is: id.recordset.method()

3 New Perspectives on XML, 2nd Edition Tutorial 9B3 THE DATA SOURCE OBJECT Here, id is the name of the data island in the Web document and method is the name of the method supported by ADO. There are several methods that can be applied to DSOs.

4 New Perspectives on XML, 2nd Edition Tutorial 9B4 THE DATA SOURCE OBJECT

5 New Perspectives on XML, 2nd Edition Tutorial 9B5 THE DATA SOURCE OBJECT For example, if you want to display the last record in a DSO whose id is “staffInfo”, run the following method: staffInfo.recordset.moveLast( ) The simplest way to run a method is to assign the method to the onClick event handler of a as shown below:

6 New Perspectives on XML, 2nd Edition Tutorial 9B6 THE DATA SOURCE OBJECT When the user clicks the button, the browser runs the command indicated by the onClick event handler, displaying the last record.

7 New Perspectives on XML, 2nd Edition Tutorial 9B7 ASSIGNING A RECORDSET METHOD

8 Practice P. 530-531 P. 533 New Perspectives on XML, 2nd Edition Tutorial 9B8

9 9 TABLE BINDING Using table data binding, each record can be displayed in a different row of a table. The syntax is:

10 New Perspectives on XML, 2nd Edition Tutorial 9B10 TABLE BINDING In the example, id is the name of the data island, field1, field2 are the fields from the recordset.

11 Practice P. 534-535 P. 536-537 New Perspectives on XML, 2nd Edition Tutorial 9B11

12 New Perspectives on XML, 2nd Edition Tutorial 9B12 TABLE PAGES As you add more records to your XML document, a table can become long and unwieldy. One way to fix this is to give the user the option of limiting the number of records displayed at any one time. The user can then move forward of backward that number of records at a time. This is called paging.

13 New Perspectives on XML, 2nd Edition Tutorial 9B13 TABLE PAGES To specify the page size, add the dataPageSize attribute to the tag: datapagesize=“number” number is the number of records you want displayed in a single page.

14 New Perspectives on XML, 2nd Edition Tutorial 9B14 NAVIGATING A TABLE PAGE A unique identifier must be assigned to a table using the ID attribute before writing a command to navigate a table page. The syntax to do this is: Here, id is the name you assign to the table object. This is needed because the commands to navigate the table pages act on the table itself not the recordset.

15 New Perspectives on XML, 2nd Edition Tutorial 9B15 TABLE METHODS AND PROPERTIES

16 New Perspectives on XML, 2nd Edition Tutorial 9B16 TABLE METHODS AND PROPERTIES To run these commands, add the command to the onClick event handler of a tag. For example, to move to the last page in a data table named “StaffTable”, you enter the attribute: onClick=“staffTable.lastPage( )”

17 Practice P. 538-539 P. 540 P. 541 New Perspectives on XML, 2nd Edition Tutorial 9B17

18 New Perspectives on XML, 2nd Edition Tutorial 9B18 HIERARCHICAL RECORDSETS

19 New Perspectives on XML, 2nd Edition Tutorial 9B19 HIERARCHICAL RECORDSETS To bind the Employee fields in the previous slide to a table, you create a table as follows: …

20 New Perspectives on XML, 2nd Edition Tutorial 9B20 THE FINAL WEB PAGE

21 Practice P. 543 P. 545-547 P. 547-548 P. 549 New Perspectives on XML, 2nd Edition Tutorial 9B21


Download ppt "New Perspectives on XML, 2nd Edition Tutorial 9B1 USING XML AS A DATA SOURCE TUTORIAL 9B."

Similar presentations


Ads by Google