Online Book Reader

Home Category

Access Cookbook - Ken Getz [332]

By Root 2018 0
button and select Append Data to Existing Table(s). Click OK and OK again.

Open the Car table in datasheet view. Note that an Autonumber value has been inserted for each row. Close the table.

Discussion


Once you have a schema file, you can view its structure using Internet Explorer, which indents all of the schema information for you, as shown in Figure 18-10.

Figure 18-10. The XSD file used to create the Car table

TIP

Visual Studio .NET provides an excellent tool for viewing and modifying XSD schema files. When you open a schema file in Visual Studio .NET, you get a graphical designer very similar to the Access Relationships window.

The file references two schemas. The xsd namespace references the XML Schema standard at the W3C's web site. The od namespace references the Office data schema developed by Microsoft for Office data types:

- xmlns:od="urn:schemas-microsoft-com:officedata">

The dataroot element is defined using a complexType XML Schema element, which enables it to contain other elements—in this case, Car elements. The maxOccurs="unbounded" attribute value means that the contents of the dataroot element, in this case Car, can occur an unlimited number of times. The xsd:element ref attribute indicates that Car is defined elsewhere in this XSD file:

The Car element is defined next, which comprises the table definition. Application-specific information is stored in the and tags, which Access uses to describe indexes defined on the table. This allows Access to define characteristics that aren't part of the W3C schema definition vocabulary. These Access-specific items defined by the Office data schema are referenced by the od namespace. The tag means that the Car data type itself is a complex type that contains other types:

unique="yes" clustered="no" />

unique="no" clustered="no" />

The next section of the XSD file defines the columns of the table, their data types, sizes, and properties. Note that the ID element is tagged with both the od:jetType="autonumber" and the od:sqlSType="int" attributes:

od:sqlSType="int" od:autoUnique="yes" od:nonNullable="yes" type="xsd:int" />

od:sqlSType="nvarchar">

od:sqlSType="nvarchar">

od:sqlSType="money" od:nonNullable="yes" type="xsd:double" />

All of the columns are defined with both Jet and equivalent SQL Server data types. This allows you to import the XSD file into an Access Project (.adp). One step you would have to perform manually for SQL Server is setting the Identity property of the SQL Server table after you have imported the XSD file and prior to importing the XML file.

See Also


The World Wide Web Consortium (W3C) site contains the following primer on XML Schema:

http://www.w3.org/TR/xmlschema-0/

The following MSDN article gives a good overview of XML Schema:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxml/html/understandxsd.asp?frame=true

18.4. Export

Return Main Page Previous Page Next Page

®Online Book Reader