PivotTable problem with ASP.NET and mspersist over HTTP

P

Peter Holpar

Hello,

I buid the XML data for a PivotTable using a DataSet transformation for XML
in an ASP.NET page (pivotdata.aspx).
In a separate ASP.NET page I try to build a PivotTable and use its XMLData
to specify the PivotTable properties for the client side (I prefer not to
use client-side scripts).

I've tried this code:

PivotTableClass Table = new PivotTableClass();
WC10.PivotView View;
Table.AutoFit = true;
Table.ConnectionString = "provider=mspersist";
Table.CommandText = @"http://myserver/myapp/pivotdata.aspx";

// this line causes an exception
"System.Runtime.InteropServices.COMException: Unspecified error"
PivotFieldSet Customer = View.FieldSets["Customer"];
Customer.Fields[0].Caption = "Customer";
View.RowAxis.InsertFieldSet(Customer, null, false);

The XML data seems to not be loaded from the pivotdata.aspx ASP.NET page,
and View.FieldSets collection is not available at all.
The same piece of code work when I use it in a Windows Forms application.
If I use
Table.CommandText = @"C:\myapp\pivotdata.xml";
in the ASP.NET page it also works (if the browser and the website are on the
same machine).

Could you help me, please?

Peter
 
D

Dan Ricker

In the code below, I don't see where the "View" variable
is being set. It could be that the code sample is
incomplete.

Re: "pivotdata.aspx" and the CommandText property.

The only xml format that is consume is that
generated "typically" by an ADODB.RecordSet save method.

Typical XML From ADODB.RecordSet:

<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-
00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly'>
<s:AttributeType name='CategoryID'
rs:number='1'>
<s:datatype dt:type='int'
dt:maxLength='4' rs:precision='10' rs:fixedlength='true'
rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='CategoryName'
rs:number='2' rs:writeunknown='true'>
<s:datatype dt:type='string'
dt:maxLength='15' rs:maybenull='false'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row CategoryID='1' CategoryName='Beverages'/>
<z:row CategoryID='2' CategoryName='Condiments'/>
<z:row CategoryID='3' CategoryName='Confections'/>
<z:row CategoryID='4' CategoryName='Dairy
Products'/>
<z:row CategoryID='5'
CategoryName='Grains/Cereals'/>
<z:row CategoryID='6' CategoryName='Meat/Poultry'/>
<z:row CategoryID='7' CategoryName='Produce'/>
<z:row CategoryID='8' CategoryName='Seafood'/>
</rs:data>
</xml>
 
P

Peter Holpar

The
View = Table.ActiveView;
line is really missing from the posted code. It can be found in the real
code.
The XML you posted is a pivot table data XML. It's OK for me. I have
problems with generating the XMLData proprty (that describes not the data
but the format and data source for the PivotTable) of the PivotTable using
server side pivot object.

Thanks,
Peter

Dan Ricker said:
In the code below, I don't see where the "View" variable
is being set. It could be that the code sample is
incomplete.

Re: "pivotdata.aspx" and the CommandText property.

The only xml format that is consume is that
generated "typically" by an ADODB.RecordSet save method.

Typical XML From ADODB.RecordSet:

<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-
00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly'>
<s:AttributeType name='CategoryID'
rs:number='1'>
<s:datatype dt:type='int'
dt:maxLength='4' rs:precision='10' rs:fixedlength='true'
rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='CategoryName'
rs:number='2' rs:writeunknown='true'>
<s:datatype dt:type='string'
dt:maxLength='15' rs:maybenull='false'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row CategoryID='1' CategoryName='Beverages'/>
<z:row CategoryID='2' CategoryName='Condiments'/>
<z:row CategoryID='3' CategoryName='Confections'/>
<z:row CategoryID='4' CategoryName='Dairy
Products'/>
<z:row CategoryID='5'
CategoryName='Grains/Cereals'/>
<z:row CategoryID='6' CategoryName='Meat/Poultry'/>
<z:row CategoryID='7' CategoryName='Produce'/>
<z:row CategoryID='8' CategoryName='Seafood'/>
</rs:data>
</xml>


-----Original Message-----
Hello,

I buid the XML data for a PivotTable using a DataSet transformation for XML
in an ASP.NET page (pivotdata.aspx).
In a separate ASP.NET page I try to build a PivotTable and use its XMLData
to specify the PivotTable properties for the client side (I prefer not to
use client-side scripts).

I've tried this code:

PivotTableClass Table = new PivotTableClass();
WC10.PivotView View;
Table.AutoFit = true;
Table.ConnectionString = "provider=mspersist";
Table.CommandText = @"http://myserver/myapp/pivotdata.aspx";

// this line causes an exception
"System.Runtime.InteropServices.COMException: Unspecified error"
PivotFieldSet Customer = View.FieldSets["Customer"];
Customer.Fields[0].Caption = "Customer";
View.RowAxis.InsertFieldSet(Customer, null, false);

The XML data seems to not be loaded from the pivotdata.aspx ASP.NET page,
and View.FieldSets collection is not available at all.
The same piece of code work when I use it in a Windows Forms application.
If I use
Table.CommandText = @"C:\myapp\pivotdata.xml";
in the ASP.NET page it also works (if the browser and the website are on the
same machine).

Could you help me, please?

Peter


.
 

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