Aggregate data columns not working after the dataset is deserializ

G

Guest

Hi,

I have a dataset with three tables in it. A parent table MenuPricing and two
child tables Labor and Parts. In the MenuPricing table I created a data
column named TotalPrice with the following expression:
Sum(Child(relParts).TotalPrice). See the xml source below. This dataset will
work fine if used locally ie in the same app domain. But if I access this
dataset from a web service, I get the error below. Is there a way arround
this bug?

System.InvalidOperationException: There is an error in XML document (1,
4190). ---> System.Data.EvaluateException: Cannot find column [TotalPrice].
at System.Data.AggregateNode.Bind(DataTable table, ArrayList list)
at System.Data.DataExpression.Bind(DataTable table)
at System.Data.DataExpression..ctor(String expression, DataTable table,
Type type)
at System.Data.DataColumn.set_Expression(String value)
at System.Data.Merger.MergeSchema(DataTable table)
at System.Data.Merger.MergeTableData(DataTable src)
at System.Data.Merger.MergeDataSet(DataSet source)
at System.Data.DataSet.Merge(DataSet dataSet, Boolean preserveChanges,
MissingSchemaAction missingSchemaAction)
at ServiceMonitor.SMService.MenuPricingDS.ReadXmlSerializable(XmlReader
reader) in C:\softdev\CS\SM2\ServiceMonitor\Web
References\SMService\Reference.cs:line 7407
at
System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader reader)
at
System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable)
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read13_GetMenuPricingResponse()
--- End of inner exception stack trace ---

Dataset definition:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="MenuPricingDS"
targetNamespace="http://tempuri.org/MenuPricingDS.xsd"
elementFormDefault="qualified"
attributeFormDefault="qualified"
xmlns="http://tempuri.org/MenuPricingDS.xsd"
xmlns:mstns="http://tempuri.org/MenuPricingDS.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
<xs:element name="MenuPricingDS" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Labor">
<xs:complexType>
<xs:sequence>
<xs:element name="DealerID" type="xs:short" minOccurs="0" />
<xs:element name="MpHeaderID" type="xs:int" minOccurs="0" />
<xs:element name="MpLaborID" msdata:ReadOnly="true"
msdata:AutoIncrement="true" type="xs:int"
minOccurs="0" />
<xs:element name="Description" type="xs:string" minOccurs="0" />
<xs:element name="Quantity" type="xs:float" minOccurs="0" />
<xs:element name="HourRate" type="xs:decimal" minOccurs="0" />
<xs:element name="TotalPrice" type="xs:decimal" minOccurs="0"
msdata:Expression="Quantity * HourRate" />
<xs:element name="OpCode" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Parts">
<xs:complexType>
<xs:sequence>
<xs:element name="DealerID" type="xs:short" minOccurs="0" />
<xs:element name="MpHeaderID" type="xs:int" minOccurs="0" />
<xs:element name="MpPartID" msdata:ReadOnly="true"
msdata:AutoIncrement="true" type="xs:int"
minOccurs="0" />
<xs:element name="PartNo" type="xs:string" minOccurs="0" />
<xs:element name="Quantity" type="xs:float" minOccurs="0" />
<xs:element name="Description" type="xs:string" minOccurs="0" />
<xs:element name="UnitPrice" type="xs:decimal" minOccurs="0" />
<xs:element name="TotalPrice" type="xs:decimal" minOccurs="0"
msdata:Expression="Quantity * UnitPrice" />
<xs:element name="Cost" type="xs:decimal" minOccurs="0" />
<xs:element name="Profit" type="xs:decimal" minOccurs="0"
msdata:Expression="UnitPrice - Cost" />
<xs:element name="TotalProfit" type="xs:decimal" minOccurs="0"
msdata:Expression="(Quantity * UnitPrice) - (Quantity * Cost)" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MenuPricing">
<xs:complexType>
<xs:sequence>
<xs:element name="DealerID" type="xs:short" />
<xs:element name="MpHeaderID" msdata:ReadOnly="true"
msdata:AutoIncrement="true" type="xs:int" />
<xs:element name="Description" type="xs:string" />
<xs:element name="YearID" type="xs:int" />
<xs:element name="ModelID" type="xs:int" />
<xs:element name="CategoryID" type="xs:int" />
<xs:element name="ShowOnWeb" type="xs:boolean" />
<xs:element name="PrePaid" type="xs:boolean" />
<xs:element name="Rental" type="xs:boolean" minOccurs="0" />
<xs:element name="TotalParts" type="xs:decimal" minOccurs="0"
msdata:Expression="Sum(Child(relParts).TotalPrice)" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="MenuPricingDSKey1" msdata:primaryKey="true">
<xs:selector xpath=".//mstns:MenuPricing" />
<xs:field xpath="mstns:DealerID" />
<xs:field xpath="mstns:MpHeaderID" />
</xs:unique>
<xs:keyref name="relParts" refer="MenuPricingDSKey1"
msdata:DeleteRule="Cascade" msdata:UpdateRule="Cascade">
<xs:selector xpath=".//mstns:parts" />
<xs:field xpath="mstns:DealerID" />
<xs:field xpath="mstns:MpHeaderID" />
</xs:keyref>
<xs:keyref name="relLabor" refer="MenuPricingDSKey1"
msdata:DeleteRule="Cascade" msdata:UpdateRule="Cascade">
<xs:selector xpath=".//mstns:Labor" />
<xs:field xpath="mstns:DealerID" />
<xs:field xpath="mstns:MpHeaderID" />
</xs:keyref>
</xs:element>
</xs:schema>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top