开发者

Disappearing dynamic data! ASP

开发者 https://www.devze.com 2023-01-26 12:41 出处:网络
I have a very strange problem that I have managed to narrow down,but cannot understand. I have two identical pages, both pulling data from a SQL server database. The code for this is identical on both

I have a very strange problem that I have managed to narrow down, but cannot understand. I have two identical pages, both pulling data from a SQL server database. The code for this is identical on both pages. On one page, the data all display correctly, on the other, one of the fields does not display - the only difference is the order in which they are displayed!! The code for the page that DOES display all of the data is:

<body >

<%=(rsPage.Fields.Item("fkPage_Parent").Value)%>Test page = 
<%=(rsPage.Fields.Item("Page_Name").Value)%>:<%=(rsPage.Fields.Item("fkPage_Owner_ID").Value)%>:<%=(rsPage.Fields.Item("fkPage_Parent").Value)%>
: end

<p>Owner = 
<%=(rsPage.Fields.Item("fkPage_Owner_ID").Value)%></p>

<p>Page name = <%=(rsPage.Fields.Item("Page_Name").Value)%> 
</p>

<p>Parent = 
<%=(rsPage.Fields.Item("fkPage_Parent").Value)%></p>

<p> </p>

</body>

</html>

and this produces the following output, exactly as expected:

911Test page = Home:1:911 : end
Owner = 1
Page name = Home
Parent = 911

The code for the seconde page that does NOT display all of the data is:

<body >

Test page = 
<%=(rsPage.Fields.Item("Page_Name").Value)%>:<%=(rsPage.Fields.Item("fkPage_Owner_ID").Value)%>:<%=(rsPage.Fields.Item("fkPage_Parent").Value)%>
: end

<p>Owner = 
<%=(rsPage.Fields.Item("fkPage_Owner_ID").Value)%></p>

<p>Page name = <%=(rsPage.Fields.Item("Page_Name").Value)%> 
</p>

<p>Parent = 
<%=(rsPage.Fields.Item("fkPage_Parent").Value)%></p>

<p> </p>

</body>

</html>

Notice the only difference is I have deleted the very first thing displayed

(<%=(rsPage.Fields.Item("fkPage_Parent").Value)%>)

everything else is identical.

The display from this second page is:

Test page = Home:1: : end
Owner 开发者_Python百科= 1
Page name = Home
Parent =

Notice that the value for the Parent field is no longer displayed.. Why?

This doesn't make any sense - has anyone else ever seen anything like this. Could it be a problem with my Windows hosting provider setup (GoDaddy)? Please help if you have any ideas.

Many thanks,

Cliff


@user475989: Assign those records to variables instead, then you should be able to move where ever you want them to display around:

<body>

<%
Dim PageName, PageOwnerId, PageParent

PageParent  = (rsPage.Fields.Item("fkPage_Parent").Value)
PageName    = (rsPage.Fields.Item("Page_Name").Value)
PageOwnerID = (rsPage.Fields.Item("fkPage_Owner_ID").Value)
%>

<p>Test page = <%=PageName %>:<%=PageOwnerID %>:<%=PageParent %> : end</p>

<p>Owner = <%=PageOwnerID %></p>

<p>Page name = <%=PageName %></p>

<p>Parent = <%=PageParent %></p>

</body>
</html>
0

精彩评论

暂无评论...
验证码 换一张
取 消