Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Always the same Error message.....

Status
Not open for further replies.

mathieustar

IS-IT--Management
Jul 12, 2005
5
GB
Hi,

I have a ASP page with an Access Database in the background.

I always get the same error message and it's driving me crazy as I really don't understand what is wrong!! Help me please :-(

Active Server Pages error 'ASP 0141'

Page Command Repeated

/Trade/Trade Answer/Display Order Forms.asp, line 15

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

My page code is:

Code:
<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="../../Connections/rsTDDisplayOrderForms.asp" -->
<%
var rsTDDisplayOrderForms = Server.CreateObject("ADODB.Recordset");
rsTDDisplayOrderForms.ActiveConnection = MM_rsTDDisplayOrderForms_STRING;
rsTDDisplayOrderForms.Source = "SELECT * FROM DisplayOrderForms";
rsTDDisplayOrderForms.CursorType = 0;
rsTDDisplayOrderForms.CursorLocation = 2;
rsTDDisplayOrderForms.LockType = 1;
rsTDDisplayOrderForms.Open();
var rsTDDisplayOrderForms_numRows = 0;
%>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
var Repeat1__numRows = 4;
var Repeat1__index = 0;
rsTDDisplayOrderForms_numRows += Repeat1__numRows;
%>
<%
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

// set the record count
var rsTDDisplayOrderForms_total = rsTDDisplayOrderForms.RecordCount;

// set the number of rows displayed on this page
if (rsTDDisplayOrderForms_numRows < 0) {            // if repeat region set to all records
  rsTDDisplayOrderForms_numRows = rsTDDisplayOrderForms_total;
} else if (rsTDDisplayOrderForms_numRows == 0) {    // if no repeat regions
  rsTDDisplayOrderForms_numRows = 1;
}

// set the first and last displayed record
var rsTDDisplayOrderForms_first = 1;
var rsTDDisplayOrderForms_last  = rsTDDisplayOrderForms_first + rsTDDisplayOrderForms_numRows - 1;

// if we have the correct record count, check the other stats
if (rsTDDisplayOrderForms_total != -1) {
  rsTDDisplayOrderForms_numRows = Math.min(rsTDDisplayOrderForms_numRows, rsTDDisplayOrderForms_total);
  rsTDDisplayOrderForms_first   = Math.min(rsTDDisplayOrderForms_first, rsTDDisplayOrderForms_total);
  rsTDDisplayOrderForms_last    = Math.min(rsTDDisplayOrderForms_last, rsTDDisplayOrderForms_total);
}
%>
<% var MM_paramName = ""; %>
<%
// *** Move To Record and Go To Record: declare variables

var MM_rs        = rsTDDisplayOrderForms;
var MM_rsCount   = rsTDDisplayOrderForms_total;
var MM_size      = rsTDDisplayOrderForms_numRows;
var MM_uniqueCol = "";
    MM_paramName = "";
var MM_offset = 0;
var MM_atTotal = false;
var MM_paramIsDefined = (MM_paramName != "" && String(Request(MM_paramName)) != "undefined");
%>
<%
// *** Move To Record: handle 'index' or 'offset' parameter

if (!MM_paramIsDefined && MM_rsCount != 0) {

  // use index parameter if defined, otherwise use offset parameter
  r = String(Request("index"));
  if (r == "undefined") r = String(Request("offset"));
  if (r && r != "undefined") MM_offset = parseInt(r);

  // if we have a record count, check if we are past the end of the recordset
  if (MM_rsCount != -1) {
    if (MM_offset >= MM_rsCount || MM_offset == -1) {  // past end or move last
      if ((MM_rsCount % MM_size) != 0) {  // last page not a full repeat region
        MM_offset = MM_rsCount - (MM_rsCount % MM_size);
      } else {
        MM_offset = MM_rsCount - MM_size;
      }
    }
  }

  // move the cursor to the selected record
  for (var i=0; !MM_rs.EOF && (i < MM_offset || MM_offset == -1); i++) {
    MM_rs.MoveNext();
  }
  if (MM_rs.EOF) MM_offset = i;  // set MM_offset to the last possible record
}
%>
<%
// *** Move To Record: if we dont know the record count, check the display range

if (MM_rsCount == -1) {

  // walk to the end of the display range for this page
  for (var i=MM_offset; !MM_rs.EOF && (MM_size < 0 || i < MM_offset + MM_size); i++) {
    MM_rs.MoveNext();
  }

  // if we walked off the end of the recordset, set MM_rsCount and MM_size
  if (MM_rs.EOF) {
    MM_rsCount = i;
    if (MM_size < 0 || MM_size > MM_rsCount) MM_size = MM_rsCount;
  }

  // if we walked off the end, set the offset based on page size
  if (MM_rs.EOF && !MM_paramIsDefined) {
    if ((MM_rsCount % MM_size) != 0) {  // last page not a full repeat region
      MM_offset = MM_rsCount - (MM_rsCount % MM_size);
    } else {
      MM_offset = MM_rsCount - MM_size;
    }
  }

  // reset the cursor to the beginning
  if (MM_rs.CursorType > 0) {
    if (!MM_rs.BOF) MM_rs.MoveFirst();
  } else {
    MM_rs.Requery();
  }

  // move the cursor to the selected record
  for (var i=0; !MM_rs.EOF && i < MM_offset; i++) {
    MM_rs.MoveNext();
  }
}
%>
<%
// *** Move To Record: update recordset stats

// set the first and last displayed record
rsTDDisplayOrderForms_first = MM_offset + 1;
rsTDDisplayOrderForms_last  = MM_offset + MM_size;
if (MM_rsCount != -1) {
  rsTDDisplayOrderForms_first = Math.min(rsTDDisplayOrderForms_first, MM_rsCount);
  rsTDDisplayOrderForms_last  = Math.min(rsTDDisplayOrderForms_last, MM_rsCount);
}

// set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount != -1 && MM_offset + MM_size >= MM_rsCount);
%>
<%
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

// create the list of parameters which should not be maintained
var MM_removeList = "&index=";
if (MM_paramName != "") MM_removeList += "&" + MM_paramName.toLowerCase() + "=";
var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";

// add the URL parameters to the MM_keepURL string
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
  var nextItem = "&" + items.item().toLowerCase() + "=";
  if (MM_removeList.indexOf(nextItem) == -1) {
    MM_keepURL += "&" + items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
  }
}

// add the Form variables to the MM_keepForm string
for (var items=new Enumerator(Request.Form); !items.atEnd(); items.moveNext()) {
  var nextItem = "&" + items.item().toLowerCase() + "=";
  if (MM_removeList.indexOf(nextItem) == -1) {
    MM_keepForm += "&" + items.item() + "=" + Server.URLencode(Request.Form(items.item()));
  }
}

// create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL + MM_keepForm;
if (MM_keepBoth.length > 0) MM_keepBoth = MM_keepBoth.substring(1);
if (MM_keepURL.length > 0)  MM_keepURL = MM_keepURL.substring(1);
if (MM_keepForm.length > 0) MM_keepForm = MM_keepForm.substring(1);
%>
<%
// *** Move To Record: set the strings for the first, last, next, and previous links

var MM_moveFirst="",MM_moveLast="",MM_moveNext="",MM_movePrev="";
var MM_keepMove = MM_keepBoth;  // keep both Form and URL parameters for moves
var MM_moveParam = "index";

// if the page has a repeated region, remove 'offset' from the maintained parameters
if (MM_size > 1) {
  MM_moveParam = "offset";
  if (MM_keepMove.length > 0) {
    params = MM_keepMove.split("&");
    MM_keepMove = "";
    for (var i=0; i < params.length; i++) {
      var nextItem = params[i].substring(0,params[i].indexOf("="));
      if (nextItem.toLowerCase() != MM_moveParam) {
        MM_keepMove += "&" + params[i];
      }
    }
    if (MM_keepMove.length > 0) MM_keepMove = MM_keepMove.substring(1);
  }
}

// set the strings for the move to links
if (MM_keepMove.length > 0) MM_keepMove += "&";
var urlStr = Request.ServerVariables("URL") + "?" + MM_keepMove + MM_moveParam + "=";
MM_moveFirst = urlStr + "0";
MM_moveLast  = urlStr + "-1";
MM_moveNext  = urlStr + (MM_offset + MM_size);
MM_movePrev  = urlStr + Math.max(MM_offset - MM_size,0);
%>
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../../StyleSheets/MainStyleSheet.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
<!--

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onLoad="MM_preloadImages('../../Images/Navigation%20Menu%20Images/Help2%20Over.jpg')">



<p align="center"><img src="../../Images/Text/Trade.gif" width="209" height="89" /></p>
<p>You are in: <a href="../../introduction.htm">HomePage</a> &gt; <a href="../trade.htm">Trade</a> 
  &gt; <a href="Display%20Order%20Forms.asp">Display Order Forms</a> </p>
<p align="center"><img src="../../Images/Bar%20Horiz.JPG" width="100%" height="6" border="0" /></p>

<table width="100%" border="1" bordercolor="#EF5682">
  <tr bgcolor="#FFCBCF"> 
    <td><p align="center">Name</p></td>
    <td><p align="center">Date</p></td>
    <td><p align="center">Preview</p></td>
    <td><p align="center">Download</p></td>
  </tr>
  <% while ((Repeat1__numRows-- != 0) && (!rsTDDisplayOrderForms.EOF)) { %>
  <tr> 
    <td><div align="center"> 
        <p><%=(rsTDDisplayOrderForms.Fields.Item("Name").Value)%></p>
      </div></td>
    <td><p align="center"><%=(rsTDDisplayOrderForms.Fields.Item("Date").Value)%></p></td>
    <td><p align="center"><img name="" src="<%=(rsTDDisplayOrderForms.Fields.Item("Preview").Value)%>" alt="" /></p></td>
    <td><p align="center"><a href="<%=(rsTDDisplayOrderForms.Fields.Item("DL Path").Value)%>"><img src="../../Images/Masters%20Buttons/Download%20Up.jpg" width="103" height="29" border="0" /></a></p></td>
  </tr>
  <%
  Repeat1__index++;
  rsTDDisplayOrderForms.MoveNext();
}
%>
</table>
<table width="100%" border="0">
  <tr>
    <td>
<div align="center"><A HREF="<%=MM_movePrev%>"><img src="../../Images/Masters%20Buttons/Previous%20Up.jpg" border="0" /></A></div></td>
    <td>
<div align="center"><A HREF="<%=MM_moveNext%>"><img src="../../Images/Masters%20Buttons/Next%20Up.jpg" border="0" /></A></div></td>
  </tr>
</table>
<p align="justify"><img src="../../Images/Bar%20Horiz.JPG" width="100%" height="6" border="0" /></p>
<p align="right"><a href="../Help/Help.htm#TheTradePage" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Help','','../../Images/Navigation%20Menu%20Images/Help2%20Over.jpg',1)"><img src="../../Images/Navigation%20Menu%20Images/Help2%20Up.jpg" alt="Go to Help for that Page." name="Help" width="103" height="29" border="0" id="Help" /></a></p>
</body>
</html>
<%
rsTDDisplayOrderForms.Close();
%>
 
OOPS!!

I just found out LOL.

Ok well, nevermind, just ignore that post. :)

;-)
 
While not applicable in your case this error often happens when an include file contains the <@LANGUAGE= command.

... just thought i'd post that in case anyone finds this thread via the search enginge ... well that and i have 5 mins to kill before a meeting.
 
Just for info.

Some macromedia extentions are a nightmare. It has a habit of adding a the @ directive to the page. I have found this the case if when adding code from an extension if it is looking for an @ directive with a code page or vice verse then the duplicate @ is added either just below the orginal or in the location where the code is added.

just reference.

Thanks

Glen
Conception | Execution
 
just remove this line from your code:

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>


-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top