HELP ME:XML中的数据显示问题!
提示信息:
- <ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<?MSSQLError HResult="0x80004005" Source="Microsoft XML Extensions to SQL Server" Description="架构: Order 上丢失的属性定义 (OrderID)"?>
</ROOT>
其他设置均无误,错误在程序中,请大家指教,谢谢!
mytemplate.xml
===================================
<ROOTxmlns:sql="urn:schemas-microsoft-com:xml-sql">
<sql:xpath-querymapping-schema="SampleSchema1.xml">
/Employee
</sql:xpath-query>
</ROOT>
SampleSchema1.xml
=======================================
<?xml version="1.0"?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<ElementType name="Customer" sql:relation="Customers">
<AttributeType name="CustomerID" dt:type="id"/>
<AttributeType name="CompanyName"/>
<AttributeType name="ContactName"/>
<AttributeType name="City"/>
<AttributeType name="Fax"/>
<AttributeType name="Orders" dt:type="idrefs" sql:id-prefix="Ord-"/>
<attribute type="CustomerID"/>
<attribute type="CompanyName"/>
<attribute type="ContactName"/>
<attribute type="City"/>
<attribute type="Fax"/>
<attribute type="Orders" sql:relation="Orders" sql:field="OrderID">
<sql:relationship
key-relation="Customers"
key="CustomerID"
foreign-relation="Orders"
foreign-key="CustomerID"/>
</attribute>
<element type="Order">
<sql:relationship
key-relation="Customers"
key="CustomerID"
foreign-relation="Orders"
foreign-key="CustomerID"/>
</element>
</ElementType>
<ElementType name="Order" sql:relation="Orders">
<Attribute Typename="OrderID" dt:type="id" sql:id-prefix="Ord-"/>
<Attribute Typename="EmployeeID"/>
<Attribute Typename="OrderDate"/>
<Attribute Typename="RequiredDate"/>
<Attribute Typename="ShippedDate"/>
<attribute type="OrderID"/>
<attribute type="EmployeeID"/>
<attribute type="OrderDate"/>
<attribute type="RequiredDate"/>
<attribute type="ShippedDate"/>
<element type="OrderDetail">
<sql:relationship
key-relation="Orders"
key="OrderID"
foreign-relation="[OrderDetails]"
foreign-key="OrderID"/>
</element>
</ElementType>
<ElementType name="OrderDetail" sql:relation="[OrderDetails]"
sql:key-fields="OrderIDProductID">
<AttributeType name="ProductID" dt:type="idref"
sql:id-prefix="Prod-"/>
<AttributeType name="UnitPrice"/>
<AttributeType name="Quantity"/>
<attribute type="ProductID"/>
<attribute type="UnitPrice" sql:field="UnitPrice"/>
<attribute type="Quantity"/>
<element type="Discount" sql:field="Discount"/>
</ElementType>
<ElementType name="Discount" dt:type="string"
sql:relation="[OrderDetails]"/>
<ElementType name="Employee" sql:relation="Employees">
<Attribute Typename="EmployeeID"/>
<Attribute Typename="LastName"/>
<Attribute Typename="FirstName"/>
<Attribute Typename="Title"/>
<attribute type="EmployeeID"/>
<attribute type="LastName"/>
<attribute type="FirstName"/>
<attribute type="Title"/>
</ElementType>
</Schema>