Skip to main content
Known Participant
June 11, 2009
Question

problem with includes in asp

  • June 11, 2009
  • 2 replies
  • 961 views

Hello,

I have an include file at the bottom of mypage, this is to list the categories of products.

At the same time I want to have a include in the main content of my page,

the problem is when I use both includes, I have an error saying

Active Server Pages error 'ASP 0141'

Page Command Repeated

/web/ildwnew/asppages/webdesigncategories.asp, line 1

The @ command can only be used once within the Active Server Page.


these are the codes for the includes:

for the webdesigncategories.asp

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/webdesignportofolio.asp" -->
<%
Dim rsCategories
Dim rsCategories_cmd
Dim rsCategories_numRows

Set rsCategories_cmd = Server.CreateObject ("ADODB.Command")
rsCategories_cmd.ActiveConnection = MM_webdesignportofolio_STRING
rsCategories_cmd.CommandText = "SELECT sectionID, sectionName FROM sections ORDER BY sectionName ASC"
rsCategories_cmd.Prepared = true

Set rsCategories = rsCategories_cmd.Execute
rsCategories_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsCategories_numRows = rsCategories_numRows + Repeat1__numRows
%>
<ul>
  <%
While ((Repeat1__numRows <> 0) AND (NOT rsCategories.EOF))
%>
    <li><a href="houstonwebdesign/houstonwebdesigncompany_portfolio.asp?webdesigncategory=<%=(rsCategories.Fields.Item("sectionID").Value)%>"><%=(rsCategories.Fields.Item("sectionName").Value)%></a></li>
    <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsCategories.MoveNext()
Wend
%>
</ul>

<%
rsCategories.Close()
Set rsCategories = Nothing
%>

for the websites.asp include

<!--#include file="../Connections/webdesignportofolio.asp" -->
<%
Dim rs_websites
Dim rs_websites_cmd
Dim rs_websites_numRows

Set rs_websites_cmd = Server.CreateObject ("ADODB.Command")
rs_websites_cmd.ActiveConnection = MM_webdesignportofolio_STRING
rs_websites_cmd.CommandText = "SELECT pDescription, pGiantImage, pID, pImage, pLargeImage, pName FROM products ORDER BY pID DESC"
rs_websites_cmd.Prepared = true

Set rs_websites = rs_websites_cmd.Execute
rs_websites_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rs_websites_numRows = rs_websites_numRows + Repeat1__numRows
%>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <%
While ((Repeat1__numRows <> 0) AND (NOT rs_websites.EOF))
%>
    <tr>
      <th width="46%" scope="col"><em><img src="<%=(rs_websites.Fields.Item("pLargeImage").Value)%>" alt="Website" /></em></th>
      <th width="54%" scope="col"><h3>Description</h3>
        <p><%=(rs_websites.Fields.Item("pDescription").Value)%></p></th>
    </tr>
    <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rs_websites.MoveNext()
Wend
%>

<tr>
        <th scope="row"><a href="#">Visit Website</a></th>
        <td> </td>
      </tr>
</table>
<%
rs_websites.Close()
Set rs_websites = Nothing
%>

Please help

This topic has been closed for replies.

2 replies

Known Participant
June 12, 2009

the attached files

Participating Frequently
June 12, 2009

>the attached files

Want to try again

It would be good to see all of the pages including the master page, the included pages referenced from the master page, and any nested includes like your connection profile. Be sure to edit the files to remove any confidential info like connection details.

Known Participant
June 12, 2009

Thank you Bregent, I found the problem, the problem was that on the masterpage I was using the same include twice.

Mauricio

Participating Frequently
June 12, 2009

The error is pretty clear on this. You have two @ declarations; either on the main page, in the includes, or in the nested includes. The complete page after all files are included can only contain one @.

Known Participant
June 12, 2009

Yes, I only have one @ declaration in the webdesigncategories.asp

I am attaching both files there.

I am confused