In an Access project, you can save SQL Server tables and views, row-returning stored procedures, and UDFs in an XML document. You can specify for your XML document a target locationsuch as a Web sitethat represents the contents of the database object at the time you exported the object to an XML file. When you export an XML file from an Access project (either manually or programmatically), you can generate as many as four other files. First, the XML document file, which isn't optional, contains an element-centric representation of the values in the database object. Second, you can create a schema with an .xsd file extension, which contains information about the database object's structure. For example, the schema file specifies the primary key of a table and the data types for each column within a table. The third and fourth files are optional and work together. The .xsl file is a transformation file for representing the XML document as an HTML table. The .xsl file transforms the data in the .xml file and represents its output as either an .htm file or an .asp file. You can choose either output file by using the manual or programmatic techniques for creating a file. With both output file types, the original version of the file contains scripting. The difference is that the .htm script runs on the client workstation, but the .asp script runs on the Web server and returns HTML to the browser. Running the script on the server accommodates a greater variety of browser configurations, but this approach puts more work on the Web server. In applications in which the server can become a bottleneck, search for ways to use client-side scripting. For an example that shows how to manually export an XML document, see the Web sidebar "Exporting a Table as an XML Document to a Web Site," available on the SQL Server Magazine Web site at http://www.sqlmag.com, InstantDoc ID 22739.
You can also accomplish the exporting and importing of XML documents programmatically. In-depth coverage of this topic is beyond the scope of this article, but Listing 1 and Listing 2 correspond to the steps for the manual examples that "Exporting a Table as an XML Document to a Web Site" describes. Listing 1 shows two procedures for exporting the authors table and generating four files: authors.xml, authors.xsd, authors.xsl, and authors.htm. You should run these two procedures from an Access project connected to the Pubs database. The first procedure, CallExportTitles(), specifies authors as the name of the source database object. Next, the procedure computes three strings that specify the .xml, .xsd, and .xsl URLs. Then, the first procedure passes to the second procedure an intrinsic constant that designates a table as the source for the XML document, the name of the source database object, and the three URLs computed earlier in the procedure. The second procedure, ExportMyXML, specifies these passed values as arguments for the ExportXML method. Note that the method belongs to the Access Application object.
Listing 2 shows two procedures that add a table to an Access project or Access database file that's based on an XML document. The first procedure computes a string value for the URL pointing at the XML document. Next, the first procedure passes the string and an intrinsic constant for creating and populating a table to the second procedure. The second procedure uses two passed arguments to invoke the ImportXML method. These two procedures need to run from an Access database file or an Access project that doesn't have an authors table.
Access 2002 is a significant improvement over earlier releases. New functionality makes Access 2002 a better development tool for SQL Server than its predecessor, and the latest version of Access is compatible with SQL Server 2000 out of the box. Although this article doesn't comment on every new feature, I hope this overview of selected SQL Serverspecific features will help you as you investigate whether Access 2002 is right for your organization's needs.
End of Article
Prev. page
1
2
3
[4]
next page -->