XML data source queried twice

M

Mike Edgar

This is a follow up to another message i posted before, i can't find the
original thread to reply to so i'll start a new one.

I am delivering reports to my users using OWC10, I use a DataSourceControl
to provide the components with data, the datasource control uses an XML
recordset in mspersist format which is served from an aspx page within the
same site.

I have managed to get the whole thing working, the problem is that for each
component on a page, I get two connections to the URL that provides the
data, this can be very frustrating and is utterly pointless as the data is
the same both times, so what gives ?

Previously, I was particuarly bothered about the cross domain warnings,
because i got a warning for every time the components get data from the URL,
but after much discussion it seems there are two ways to get rid of the
warnings, A) set your site to be a trusted one in the internet options of
the browser B) use RDS

I've decided that i can live with making my users add a trusted site, but
even though i don't see two warnings for each component, the connection is
still being made twice, which i can't live with.

I've looked at KB article Q249805 (
http://support.microsoft.com/?kbid=249805 ) as suggested, during the last
round of posts, by Jim Vita, a helpful bloke from microsoft developer
support, but the code used there has much the same effect. Although it was
using OWC9 rather than 10, when i tweaked the code to make it use OWC10, the
results are the same as my code.

Debugging my script/code I can see that the connection is made where the DSC
adds the recordset AND on the first InsertFieldSet call, i'm guessing that
the first call that requires the component to actually bind to the data
would cause this second connection...

my code is shown below, i have also included the XML that is returned from
my url, in case anyone wants to implement it...

thanks,

Mike

-------8< -----------8< ------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>MakeReport</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="VBScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="monactivestyles.css" type="text/css" rel="stylesheet">
<script language="javascript" src="FilterControls/calendar.js"></script>
<script language="vbscript" src="FilterControls/common.vbs"></script>
</HEAD>
<body leftMargin="1" topMargin="20" MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="makereport.aspx?ReportID=11"
id="Form1">


<div id="content" onresize="setframesize()" style="MARGIN-LEFT: 5px"
align="left" MS_POSITIONING="FlowLayout">

<OBJECT id="DSC" style="display:none;"
classid="clsid:0002E553-0000-0000-C000-000000000046">
</OBJECT>
<OBJECT id="ReportItem0" style="display:none;"
classid="CLSID:0002E552-0000-0000-C000-000000000046">
</OBJECT>

<SCRIPT language="VBScript">
Sub Window_onLoad()

set DSC = document.DSC
DSC.ConnectionString = "provider=mspersist"

set ReportItem0 = document.ReportItem0

sURL = "MakeData.aspx?ReportItemID=10"
ReportItem0exists = false
for each datamember in DSC.RecordsetDefs
if datamember.Name = "ReportItem0Data" then
ReportItem0exists = true
end if
next
if ReportItem0exists = false then
DSC.RecordsetDefs.AddNew sURL, DSC.Constants.dscCommandFile,
"ReportItem0Data"
end if

set ReportItem0.DataSource = DSC
ReportItem0.DataMember = "ReportItem0Data"
ReportItem0.AutoFit = true
ReportItem0.DisplayToolbar = false
ReportItem0.ActiveView.ExpandDetails =
ReportItem0.Constants.plExpandNever
ReportItem0.ActiveView.TitleBar.Caption = "Locate Unauthorised Software"
ReportItem0.ActiveView.FilterAxis.InsertFieldSet
ReportItem0.ActiveView.FieldSets("Location")
ReportItem0.ActiveView.RowAxis.InsertFieldSet
ReportItem0.ActiveView.FieldSets("Publisher")
ReportItem0.ActiveView.FieldSets("Publisher").Fields(0).Subtotals(1) =
false
ReportItem0.ActiveView.RowAxis.InsertFieldSet
ReportItem0.ActiveView.FieldSets("Product")
ReportItem0.ActiveView.FieldSets("Product").Fields(0).Subtotals(1) =
false
ReportItem0.ActiveView.RowAxis.InsertFieldSet
ReportItem0.ActiveView.FieldSets("M Version")
ReportItem0.ActiveView.FieldSets("M Version").Fields(0).Subtotals(1) =
false
ReportItem0.ActiveView.DataAxis.InsertFieldSet
ReportItem0.ActiveView.FieldSets("Computer Name")
ReportItem0.ActiveView.DataAxis.InsertFieldSet
ReportItem0.ActiveView.FieldSets("Domain")
ReportItem0.ActiveView.DataAxis.InsertFieldSet
ReportItem0.ActiveView.FieldSets("IP")
ReportItem0.ActiveView.DataAxis.InsertFieldSet
ReportItem0.ActiveView.FieldSets("Primary User")
ReportItem0.ActiveView.DataAxis.InsertFieldSet
ReportItem0.ActiveView.FieldSets("Last User")
Dim totComputer_Name
set totComputer_Name = ReportItem0.ActiveView.AddTotal("Count of
Computer Name", ReportItem0.ActiveView.FieldSets("Computer Name").Fields(0),
ReportItem0.Constants.plFunctionCount)
ReportItem0.ActiveView.DataAxis.InsertTotal totComputer_Name
ReportItem0.style.display = "inline"
End Sub 'Window_onLoad()

</SCRIPT>
</div>
</form>
</body>
</HTML>

---------8< ----------------8< -----------------
<?xml version="1.0" encoding="utf-8" ?>
- <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="Product" rs:number="1" rs:nullable="true"
rs:writeunknown="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="255" />
</s:AttributeType>
- <s:AttributeType name="Publisher" rs:number="2" rs:nullable="true"
rs:writeunknown="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="255" />
</s:AttributeType>
- <s:AttributeType name="c2" rs:name="M Version" rs:number="3"
rs:nullable="true" rs:writeunknown="true">
<s:datatype dt:type="int" dt:maxLength="4" rs:precision="10"
rs:fixedlength="true" />
</s:AttributeType>
- <s:AttributeType name="c3" rs:name="Computer Name" rs:number="4"
rs:nullable="true" rs:writeunknown="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="255" />
</s:AttributeType>
- <s:AttributeType name="Domain" rs:number="5" rs:nullable="true"
rs:writeunknown="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="255" />
</s:AttributeType>
- <s:AttributeType name="IP" rs:number="6" rs:nullable="true"
rs:writeunknown="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="255" />
</s:AttributeType>
- <s:AttributeType name="c6" rs:name="Primary User" rs:number="7"
rs:nullable="true" rs:writeunknown="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="50" />
</s:AttributeType>
- <s:AttributeType name="c7" rs:name="Last User" rs:number="8"
rs:nullable="true" rs:writeunknown="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="50" />
</s:AttributeType>
- <s:AttributeType name="Location" rs:number="9" rs:nullable="true"
rs:writeunknown="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="255" />
</s:AttributeType>
<s:extends type="rs:rowbase" />
</s:ElementType>
</s:Schema>
- <rs:data>
<z:row Product="KaZaA Media Desktop" Publisher="Sharman Networks" c2="1"
c3="EKLIS" Domain="MONACTIVE" IP="192.168.1.180" c6="administrator"
c7="administrator" />
<z:row Product="Discovery Evaluation" Publisher="Centennial UK Ltd."
c2="4" c3="GRAEMEH" Domain="MONACTIVE" IP="192.168.1.178" c6="graemeh"
c7="graemeh" />
<z:row Product="Kazaa Media Desktop" Publisher="Sharman Networks" c2="2"
c3="MONKEY" Domain="MUPPETS" IP="192.168.1.177" c6="Mike" c7="Mike" />
<z:row Product="Kazaa Media Desktop" Publisher="Sharman Networks" c2="2"
c3="NEELA" Domain="MONACTIVE" IP="192.168.1.189" c6="neela" c7="neela" />
<z:row Product="Kazaa Media Desktop" Publisher="Sharman Networks" c2="2"
c3="RACHELS" Domain="MUPPETS" IP="192.168.1.183" c6="rachel" c7="rachel" />
</rs:data>
</xml>
 
M

Mike Edgar

I have been in discussion with microsoft developer support over this issue
as it has serious implications for anyone who uses a URL to source XML data
for the office web components.

Say my asp page takes 10 seconds to run my query against the db and return
the results in ms-persistence format XML - because of the behaviour of the
OWC - the user sees nothing until 20 seconds have elapsed (as my query is
run twice). Extend the time it takes to run your query and it starts
becoming totally unacceptable. I am told that "the first connection happens
when various initialisation processes take place. This includes initialising
the field list but this process should be quick as the OWC does not request
that data be returned.The second connection is when the recordset data is
actually returned", but there is no way for OWC to tell the URL that only
the field list should be returned. Any modification of the connection string
would just cause another connection.

look at any of the KB articles i list here, they all tell you how to use a
URL to provide the OWC with data, but nowhere does it mention this
behaviour.

HOWTO: Use XML Data with the Chart Component
http://support.microsoft.com/?kbid=249805
HOW TO: Use a DataSet with the Office XP Chart Component and ASP.NET
http://support.microsoft.com/?kbid=303016
HOWTO: Use an XML DataSource with the Office XP Chart Component
http://support.microsoft.com/?kbid=286212

The final result was that I was told there is no way to stop/modify this
behaviour and no workaround could be suggested, so if this is a problem,
then stop using OWC. That is just a great way to promote the company and
it's products... not one suggestion how i might do it differently.

I can't believe that they took this seriously at any point, not one of my
questions was answered, the MS bloke just kept stating that the components
are working as they are designed to, I asked for any ideas for a workaround
but got no suggestions. I used up one of my support incidents for this ?

As it is, I made a workaround for myself, it's not what i wanted, but it'll
do. It's also another method cribbed from an ms KB article, I have
incorporated the xml into the same page as a data island, so the database
work is done only once, but it isn't as good because the whole page has to
be reloaded to refresh the data. For anyone who wants to do the same, check
the second solution in the "HOWTO: Use an XML DataSource with the Office XP
Chart Component" KB article... (link above)

again, i can't believe that we paid for that level of support... if it
wasn't just part of the expensive but otherwise worthwile MSDN subscription
we run, i'd ask for the money back !

Mike.
 

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