Copy link to clipboard
Copied
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 = 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
Copy link to clipboard
Copied
Please show us the recordset definition for both pages.
Copy link to clipboard
Copied
OK, here's the recordset definition. It calls a SQL Server stored procedure which is also shown below. Hope you can spot something for me as I'm going round in ever decreasing circles! Thanks.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Option Explicit %>
<!--#include virtual="/Connections/CMSMaster.asp" -->
<%
Dim rsPage__pkPage_ID
rsPage__pkPage_ID = "1"
If (Request.QueryString("PageID") <> "") Then
rsPage__pkPage_ID = Request.QueryString("PageID")
End If
%>
<%
Dim rsPage
Dim rsPage_cmd
Dim rsPage_numRows
Set rsPage_cmd = Server.CreateObject ("ADODB.Command")
rsPage_cmd.ActiveConnection = MM_CMSMaster_STRING
rsPage_cmd.CommandText = "{call dbo.usp_Get_Page(?)}"
rsPage_cmd.Prepared = true
rsPage_cmd.Parameters.Append rsPage_cmd.CreateParameter("param1", 5, 1, -1, rsPage__pkPage_ID) ' adDouble
Set rsPage = rsPage_cmd.Execute
rsPage_numRows = 0
%>
======================================
SQL Server stored procedure is:
ALTER PROCEDURE [dbo].[usp_Get_Page]
(
@pkPage_ID int
)
AS
SELECT dbo.tbl_Page.pkPage_ID, dbo.tbl_Page.fkPage_Type, dbo.tbl_Page.Page_Name, dbo.tbl_Page.Page_Title, dbo.tbl_Page.Page_Description,
dbo.tbl_Page.Page_Content, dbo.tbl_Page.fkPage_Parent, dbo.tbl_Page.Page_FileName, dbo.tbl_Page.fkPage_Owner_ID, dbo.tbl_AdminUser.AdminUser_FirstName As Page_OwnerFirstName,
dbo.tbl_AdminUser.AdminUser_LastName As Page_OwnerLastName, dbo.tbl_AdminUser.AdminUser_Login As Page_OwnerLogin
FROM dbo.tbl_Page INNER JOIN
dbo.tbl_AdminUser ON dbo.tbl_Page.fkPage_Owner_ID = dbo.tbl_AdminUser.pkAdminUser_ID
WHERE (dbo.tbl_Page.pkPage_ID = @pkPage_ID)
Copy link to clipboard
Copied
I have further reduced the problem and, for clarity. removed the use of stored procedures so the SQL code is now included in the script.
I have two test pages: test.asp and test2.asp and you can see these at http://www.agoodrant.net/test.asp and http://www.agoodrant.net/test2.asp on GoDaddy servers.
The code for these two pages is identical with one minor change - one of the database fields (<%=(rsPage.Fields.Item("fkPage_Parent").Value)%>) with a value of 0 is inserted as the first item in the bodyof the page in test.asp but is omitted in test2.asp. There are NO other differences.
Running test.asp produces this:
0Test page = Home:1:0 : end
Owner = 1
Page name = Home
Parent = 0
which is correct. Please notice that the field for Parent () is displayed in the 3 place it should be (1st line twice and last line).
Running test2.asp produces this:
Test page = Home:1: : end
Owner = 1
Page name = Home
Parent =
which is incorrect! Please notice that the field for Parent (<%=(rsPage.Fields.Item("fkPage_Parent").Value)%>)) is not displayed in the two place it should be (1st line and last line).
Why? This does NOT make any sense and, as I said, both of these test pages work perfectly as expected on my test server so there must be a configuration difference somewhere that accounts for this odd behaviour. I have searched the web for solutions and posted the problem on various message boards but can find no solution.
You can replicate the same problem with different data by appending ?PageID=2 to the URL:
http://www.agoodrant.net/test.asp?PageID=2 and http://www.agoodrant.net/test2.asp?PageID=2
I have replicated the problem on 2 different GoDaddy hosting accounts, but the problem does NOT occur on my home PC!
The code for test.asp is:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Option Explicit %>
<!--#include virtual="/Connections/CMSMaster.asp" -->
<%
Dim rsPage__param1
rsPage__param1 = "1"
If (Request.QueryString("PageID") <> "") Then
rsPage__param1 = Request.QueryString("PageID")
End If
%>
<%
Dim rsPage
Dim rsPage_cmd
Dim rsPage_numRows
Set rsPage_cmd = Server.CreateObject ("ADODB.Command")
rsPage_cmd.ActiveConnection = MM_CMSMaster_STRING
rsPage_cmd.CommandText = "SELECT dbo.tbl_Page.pkPage_ID, dbo.tbl_Page.fkPage_Type, dbo.tbl_Page.Page_Name, dbo.tbl_Page.Page_Title, dbo.tbl_Page.Page_Description, dbo.tbl_Page.Page_Content, dbo.tbl_Page.fkPage_Parent, dbo.tbl_Page.Page_FileName, dbo.tbl_Page.fkPage_Owner_ID, dbo.tbl_AdminUser.AdminUser_FirstName As Page_OwnerFirstName, dbo.tbl_AdminUser.AdminUser_LastName As Page_OwnerLastName, dbo.tbl_AdminUser.AdminUser_Login As Page_OwnerLogin FROM dbo.tbl_Page INNER JOIN dbo.tbl_AdminUser ON dbo.tbl_Page.fkPage_Owner_ID = ?"
rsPage_cmd.Prepared = true
rsPage_cmd.Parameters.Append rsPage_cmd.CreateParameter("param1", 5, 1, -1, rsPage__param1) ' adDouble
Set rsPage = rsPage_cmd.Execute
rsPage_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test2</title>
</head>
<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>
<%
rsPage.Close()
Set rsPage = Nothing
%>
And the code for test2.asp is as follows:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Option Explicit %>
<!--#include virtual="/Connections/CMSMaster.asp" -->
<%
Dim rsPage__param1
rsPage__param1 = "1"
If (Request.QueryString("PageID") <> "") Then
rsPage__param1 = Request.QueryString("PageID")
End If
%>
<%
Dim rsPage
Dim rsPage_cmd
Dim rsPage_numRows
Set rsPage_cmd = Server.CreateObject ("ADODB.Command")
rsPage_cmd.ActiveConnection = MM_CMSMaster_STRING
rsPage_cmd.CommandText = "SELECT dbo.tbl_Page.pkPage_ID, dbo.tbl_Page.fkPage_Type, dbo.tbl_Page.Page_Name, dbo.tbl_Page.Page_Title, dbo.tbl_Page.Page_Description, dbo.tbl_Page.Page_Content, dbo.tbl_Page.fkPage_Parent, dbo.tbl_Page.Page_FileName, dbo.tbl_Page.fkPage_Owner_ID, dbo.tbl_AdminUser.AdminUser_FirstName As Page_OwnerFirstName, dbo.tbl_AdminUser.AdminUser_LastName As Page_OwnerLastName, dbo.tbl_AdminUser.AdminUser_Login As Page_OwnerLogin FROM dbo.tbl_Page INNER JOIN dbo.tbl_AdminUser ON dbo.tbl_Page.fkPage_Owner_ID = ?"
rsPage_cmd.Prepared = true
rsPage_cmd.Parameters.Append rsPage_cmd.CreateParameter("param1", 5, 1, -1, rsPage__param1) ' adDouble
Set rsPage = rsPage_cmd.Execute
rsPage_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test2</title>
</head>
<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>
<%
rsPage.Close()
Set rsPage = Nothing
%>
Find more inspiration, events, and resources on the new Adobe Community
Explore Now