473,396 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Query producing XML appears to be cached

Hi folks,

ASP.NET2, Sql Server 2005

I have an app that executed a sql server query that produces an XML
file used as the DateFile for an XMLDataSource bound to a TreeView. The
bizarre thing is that it seems to be cached even if I make a change to
the stored procedure. For example I changed a string literal in the
proc and it was completely ignored then next time I viewed the page.

The really wierd bit is that the response time is as if the query was
actually executing. At the moment the data in the database is not
refines and as a result the query is taking up to 5 seconds to run.
Regardless of the fact that the result appears to be cached the query
is still taking up to 5 seconds each time.

The only thing that seems to kick it into gear is:

Stop IIS
Kill the ASPNET worker process
Delete the temporary aspnet files for the site.
Start it all up again, and its fine.

I've tried it Firefox 1.5 and 2.0 (and disabling the cache using the
Web Developer Toolbar). Also tried IE 6 and 7 so dont think its browser
related.

This sounds like it should be a known issue but couldnt find anything
to do with it. Included are the proc, code behind, source view and
example of the XML returned from the proc.

CODE BEHIND:

protected void Page_Load(object sender, EventArgs e) {
dsXmlContent.Data = GetXmlDoc().OuterXml;
}

protected XmlDocument GetXmlDoc() {
SqlConnection cn = new SqlConnection(@"data
source=server;
database=database; user id=user; password=password");
SqlCommand cmd = new
SqlCommand("procContent_GetContentMap", cn);
cn.Open();
XmlReader xr = cmd.ExecuteXmlReader();
XmlDocument doc = new XmlDocument();
doc.Load(xr);

xr.Close();
cn.Close();

return doc;

}

STORED PROCEDURE

Create PROCEDURE [dbo].[procContent_GetContentMap]

AS
BEGIN
SET NOCOUNT ON;

select
1 tag,
null parent,
null [Section!1!Section],
null [Sections!2!SectionID],
null [Sections!2!SectionName],
NULL [Pages!3!PageID],
NULL [Pages!3!PageName],
NULL [Contents!4!ContentID],
NULL [Contents!4!Html]

union all

select
2 tag,
1 parent,
null,
ID,
SectionName,
NULL,
NULL,
NULL,
NULL

from
Section

union all

select
3,
2,
null,
Section.ID,
null,
Page.ID,
Page.PageName,
NULL,
NULL

from
Section, Page

where
Section.ID = Page.SectionID

union all

select
4,
3,
null,
Section.ID,
null,
Page.ID,
null,
[Content].ID,
[Content].Html

from Section, Page, [Content]

where Section.ID = Page.SectionID
and Page.ID = [Content].PageID

order by [Section!1!Section], [Sections!2!SectionID],
[Pages!3!PageID], [Contents!4!ContentID]

for xml explicit

end

GENERATED XML DOCUMENT

<Section>
<Sections SectionID="1" SectionName="Test Section 1">
<Pages PageID="1" PageName="Section 1 Page 1">
<Contents ContentID="1" Html="Section 1 Page 1 content" />
</Pages>
<Pages PageID="2" PageName="Section 1 Page 2">
<Contents ContentID="2" Html="Section 1 Page 2 content" />
</Pages>
</Sections>
<Sections SectionID="2" SectionName="Test Section 2">
<Pages PageID="3" PageName="Section 2 Page 1">
<Contents ContentID="3" Html="Section 2 Page 1 content" />
</Pages>
<Pages PageID="4" PageName="Section 2 Page 2">
<Contents ContentID="4" Html="Section 2 Page 2 content" />
</Pages>
</Sections>
</Section>

SOURCE EXTRACT OF THE TREEVIEW CONTROL

<asp:TreeView ID="tvNav" runat="server" Style="position: relative"
PathSeparator="." DataSourceID="dsXmlContent" ExpandDepth="0"
ImageSet="XPFileExplorer" NodeIndent="15">
<DataBindings>
<asp:TreeNodeBinding
DataMember="Sections" ValueField="SectionID"
TextField="SectionName" />
<asp:TreeNodeBinding
DataMember="Pages" ValueField="PageID"
TextField="PageName" />
<asp:TreeNodeBinding
DataMember="Contents" ValueField="ContentID"
TextField="Html" />
</DataBindings>
</asp:TreeView>

Nov 20 '06 #1
2 1344
Hi,
By default the XMLDataSource control always caches its data, so try to set
the EnableCaching property to false.
Regards,
Mohamed Mosalem

"Simon Rigby" wrote:
Hi folks,

ASP.NET2, Sql Server 2005

I have an app that executed a sql server query that produces an XML
file used as the DateFile for an XMLDataSource bound to a TreeView. The
bizarre thing is that it seems to be cached even if I make a change to
the stored procedure. For example I changed a string literal in the
proc and it was completely ignored then next time I viewed the page.

The really wierd bit is that the response time is as if the query was
actually executing. At the moment the data in the database is not
refines and as a result the query is taking up to 5 seconds to run.
Regardless of the fact that the result appears to be cached the query
is still taking up to 5 seconds each time.

The only thing that seems to kick it into gear is:

Stop IIS
Kill the ASPNET worker process
Delete the temporary aspnet files for the site.
Start it all up again, and its fine.

I've tried it Firefox 1.5 and 2.0 (and disabling the cache using the
Web Developer Toolbar). Also tried IE 6 and 7 so dont think its browser
related.

This sounds like it should be a known issue but couldnt find anything
to do with it. Included are the proc, code behind, source view and
example of the XML returned from the proc.

CODE BEHIND:

protected void Page_Load(object sender, EventArgs e) {
dsXmlContent.Data = GetXmlDoc().OuterXml;
}

protected XmlDocument GetXmlDoc() {
SqlConnection cn = new SqlConnection(@"data
source=server;
database=database; user id=user; password=password");
SqlCommand cmd = new
SqlCommand("procContent_GetContentMap", cn);
cn.Open();
XmlReader xr = cmd.ExecuteXmlReader();
XmlDocument doc = new XmlDocument();
doc.Load(xr);

xr.Close();
cn.Close();

return doc;

}

STORED PROCEDURE

Create PROCEDURE [dbo].[procContent_GetContentMap]

AS
BEGIN
SET NOCOUNT ON;

select
1 tag,
null parent,
null [Section!1!Section],
null [Sections!2!SectionID],
null [Sections!2!SectionName],
NULL [Pages!3!PageID],
NULL [Pages!3!PageName],
NULL [Contents!4!ContentID],
NULL [Contents!4!Html]

union all

select
2 tag,
1 parent,
null,
ID,
SectionName,
NULL,
NULL,
NULL,
NULL

from
Section

union all

select
3,
2,
null,
Section.ID,
null,
Page.ID,
Page.PageName,
NULL,
NULL

from
Section, Page

where
Section.ID = Page.SectionID

union all

select
4,
3,
null,
Section.ID,
null,
Page.ID,
null,
[Content].ID,
[Content].Html

from Section, Page, [Content]

where Section.ID = Page.SectionID
and Page.ID = [Content].PageID

order by [Section!1!Section], [Sections!2!SectionID],
[Pages!3!PageID], [Contents!4!ContentID]

for xml explicit

end

GENERATED XML DOCUMENT

<Section>
<Sections SectionID="1" SectionName="Test Section 1">
<Pages PageID="1" PageName="Section 1 Page 1">
<Contents ContentID="1" Html="Section 1 Page 1 content" />
</Pages>
<Pages PageID="2" PageName="Section 1 Page 2">
<Contents ContentID="2" Html="Section 1 Page 2 content" />
</Pages>
</Sections>
<Sections SectionID="2" SectionName="Test Section 2">
<Pages PageID="3" PageName="Section 2 Page 1">
<Contents ContentID="3" Html="Section 2 Page 1 content" />
</Pages>
<Pages PageID="4" PageName="Section 2 Page 2">
<Contents ContentID="4" Html="Section 2 Page 2 content" />
</Pages>
</Sections>
</Section>

SOURCE EXTRACT OF THE TREEVIEW CONTROL

<asp:TreeView ID="tvNav" runat="server" Style="position: relative"
PathSeparator="." DataSourceID="dsXmlContent" ExpandDepth="0"
ImageSet="XPFileExplorer" NodeIndent="15">
<DataBindings>
<asp:TreeNodeBinding
DataMember="Sections" ValueField="SectionID"
TextField="SectionName" />
<asp:TreeNodeBinding
DataMember="Pages" ValueField="PageID"
TextField="PageName" />
<asp:TreeNodeBinding
DataMember="Contents" ValueField="ContentID"
TextField="Html" />
</DataBindings>
</asp:TreeView>

Nov 21 '06 #2
Mohamed,

I swear I looked for such a property :).

Many Thanks

Nov 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: M Wells | last post by:
Hi All, I have a table that currently contains approx. 8 million records. I'm running a SELECT query against this table that in some circumstances is either very quick (ie results returned in...
2
by: Neeraj | last post by:
Hii , I am using Db2 V 7.1 on ZOS I have the following Java Code query.append("insert into "); query.append(schemaName+".EMAIL_DATA "); query.append("(EMAIL_NBR, DT_FIRST_SENT,SUBJECT...
4
by: Mark D Powell | last post by:
SQL Server 2000 SP3A Last week one of our processes starting issuing or suffering deadlock detected errors every 15 minutes or so. I have read several articles at MS on the subject. I set a...
7
by: Frankie | last post by:
I'm trying to run the following search query: $query = sprintf ("SELECT itemNumber, thumbnailURL, title, description, price FROM apparel,hats WHERE apparel.title OR apparel.description OR...
15
by: wizofaus | last post by:
I have a chunk of code which is essentially IDbCommand cmd = db.CreateCommand(); cmd.CommandText = "SELECT X, Y, Count(*) FROM Foo WHERE Z = 1 GROUP BY X, Y"; using (IDataReader reader =...
29
by: wizofaus | last post by:
I previously posted about a problem where it seemed that changing the case of the word "BY" in a SELECT query was causing it to run much much faster. Now I've hit the same thing again, where...
1
by: Ed244 | last post by:
Hi, I'm in the process of producing a database for a college project and have a slight problem I was wondering whether you could help me with. The area I'm having problems with takes a value...
17
by: NeoAlchemy | last post by:
I am starting to find more web pages that are using a query parameters after the JavaScript file. Example can be found at www.opensourcefood.com. Within the source you'll see: <script...
0
by: ticktack | last post by:
Hi there, I am trying to do a UNION with slightly different queries, it appears to work but it now bring in another problem. The second part of the UNION need to have a an extra field value...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.