|
 |
asp_web_howto thread: page doesnt work when uploaded to the server
Message #1 by "taherm@f... on Mon, 20 Aug 2001 14:54:08
|
|
my page works fine when viewed locally but when uploaded to the server,
only some all the features work except for one.
plz visit my site at
http://216.119.79.214/phones/www/admin/displayorders.asp
when you select august from drop down menu it displays no records for taht
month which is wrong. the code for that page is as follows:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/phones1.asp" -->
<%
Dim Recordset1__datrefw
Recordset1__datrefw = "%/%/2001"
if (request("datrefww") <> "") then Recordset1__datrefw = request
("datrefww")
%>
<%
Dim Recordset1__sorting
Recordset1__sorting = "Invoicenumber"
if (request("sorting") <> "") then Recordset1__sorting = request("sorting")
%>
<%
Dim Recordset1__ordering
Recordset1__ordering = "ASC"
if (request("ordering") <> "") then Recordset1__ordering = request
("ordering")
%>
<%
dim sql1
dim sql2
dim sql3
dim strsql
if request.form("sorting") <> "" then
sql1 = request.form("ordering")
sql2 = request.form("sorting")
strsql = cstr("SELECT * FROM Orders ORDER BY " & sql2 & " " & sql1)
else
strsql = cstr("SELECT * FROM Orders ORDER BY FirstName ASC")
end if
'response.write strsql
%>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_phones1_STRING
Recordset1.Source = "SELECT * FROM Invoice WHERE orderdate like '" +
Replace(Recordset1__datrefw, "'", "''") + "' AND GrandTotal ORDER BY " +
Replace(Recordset1__sorting, "'", "''") + " " + Replace
(Recordset1__ordering, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = 20
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats
variables
' set the record count
Recordset1_total = Recordset1.RecordCount
' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
Recordset1_numRows = 1
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
If (Recordset1_first > Recordset1_total) Then Recordset1_first =
Recordset1_total
If (Recordset1_last > Recordset1_total) Then Recordset1_last =
Recordset1_total
If (Recordset1_numRows > Recordset1_total) Then Recordset1_numRows =
Recordset1_total
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count
them
If (Recordset1_total = -1) Then
' count the total records by iterating through the recordset
Recordset1_total=0
While (Not Recordset1.EOF)
Recordset1_total = Recordset1_total + 1
Recordset1.MoveNext
Wend
' reset the cursor to the beginning
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
' set the number of rows displayed on this page
If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
Recordset1_numRows = Recordset1_total
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1
If (Recordset1_first > Recordset1_total) Then Recordset1_first =
Recordset1_total
If (Recordset1_last > Recordset1_total) Then Recordset1_last =
Recordset1_total
End If
%>
<%
' *** Move To Record and Go To Record: declare variables
Set MM_rs = Recordset1
MM_rsCount = Recordset1_total
MM_size = Recordset1_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined And MM_rsCount <> 0) then
' use index parameter if defined, otherwise use offset parameter
r = Request.QueryString("index")
If r = "" Then r = Request.QueryString("offset")
If r <> "" Then MM_offset = Int(r)
' if we have a record count, check if we are past the end of the
recordset
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or
move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a
full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' move the cursor to the selected record
i = 0
While ((Not MM_rs.EOF) And (i < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
i = i + 1
Wend
If (MM_rs.EOF) Then MM_offset = i ' set MM_offset to the last possible
record
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display
range
If (MM_rsCount = -1) Then
' walk to the end of the display range for this page
i = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or i < MM_offset + MM_size))
MM_rs.MoveNext
i = i + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = i
If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount
End If
' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If
' move the cursor to the selected record
i = 0
While (Not MM_rs.EOF And i < MM_offset)
MM_rs.MoveNext
i = i + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
Recordset1_first = MM_offset + 1
Recordset1_last = MM_offset + MM_size
If (MM_rsCount <> -1) Then
If (Recordset1_first > MM_rsCount) Then Recordset1_first = MM_rsCount
If (Recordset1_last > MM_rsCount) Then Recordset1_last = MM_rsCount
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And 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
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" &
MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode
(Request.QueryString(Item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form
(Item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the
strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len
(MM_keepBoth) - 1)
if (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len
(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len
(MM_keepForm) - 1)
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and
previous links
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
' if the page has a repeated region, remove 'offset' from the maintained
parameters
If (MM_size > 0) Then
MM_moveParam = "offset"
If (MM_keepMove <> "") Then
params = Split(MM_keepMove, "&")
MM_keepMove = ""
For i = 0 To UBound(params)
nextItem = Left(params(i), InStr(params(i),"=") - 1)
If (StrComp(nextItem,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & params(i)
End If
Next
If (MM_keepMove <> "") Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove <> "") Then MM_keepMove = MM_keepMove & "&"
urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam
& "="
MM_moveFirst = urlStr & "0"
MM_moveLast = urlStr & "-1"
MM_moveNext = urlStr & Cstr(MM_offset + MM_size)
prev = MM_offset - MM_size
If (prev < 0) Then prev = 0
MM_movePrev = urlStr & Cstr(prev)
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID
strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If
On Error Resume Next
If (nLCID > -1) Then
Session.LCID = nLCID
End If
If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If
If (nLCID > -1) Then
Session.LCID = oldLCID
End If
DoDateTime = strRet
End Function
</SCRIPT>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../style.css" type="text/css">
<script language="JavaScript">
<!--
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.0
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 && document.getElementById) x=document.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 bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0">
<form name="form1" method="post" action="displayorders.asp">
<table width="620" border="0" cellspacing="0" cellpadding="0"
class="content">
<tr>
<td width="20"> </td>
<td width="365"> </td>
<td width="85"> </td>
<td width="150"> </td>
</tr>
<tr>
<td width="20"> </td>
<td width="365"><font size="3" class="heading_bold">Display
Orders</font></td>
<td width="85"> </td>
<td width="150" align="left">
<div align="left"><font size="1" class="content">
<script language="JavaScript1.2">
<!--
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
if (year < 2000)
year = year + 1900;
document.write("<center>" + lmonth + " ");
document.write(date + ", " + year + "</center>");
// End -->
</script>
</font></div>
</td>
</tr>
<tr>
<td width="20"> </td>
<td width="365" class="font">
<%
TM_counter = 0
For i = 1 to Recordset1_total Step MM_size
TM_counter = TM_counter + 1
TM_PageEndCount = i + MM_size - 1
if TM_PageEndCount > Recordset1_total Then TM_PageEndCount =
Recordset1_total
if i <> MM_offset + 1 then
Response.Write("<a href=""" & Request.ServerVariables("URL") & "?" &
MM_keepMove & "offset=" & i-1 & """>")
Response.Write(TM_counter & "</a>")
else
Response.Write("<b>" & TM_counter & "</b>")
End if
if(TM_PageEndCount <> Recordset1_total) then Response.Write("<img
src=""../images/1pxbottom.gif"" border=0>")
next
%>
<a href="<%=MM_moveNext%>">Next>></a>
</td>
<td width="85"><font size="1">Month</font></td>
<td width="150">
<select name="datrefww">
<option value="%/%/2001" selected>Show All</option>
<option value="%/01/2001">Jan</option>
<option value="%/02/2001">Feb</option>
<option value="%/03/2001">Mar</option>
<option value="%/04/2001">Apr</option>
<option value="%/05/2001">May</option>
<option value="%/06/2001">Jun</option>
<option value="%/07/2001">Jul</option>
<option value="%/08/2001">Aug</option>
<option value="%/09/2001">Sep</option>
<option value="%/10/2001">Oct</option>
<option value="%/11/2001">Nov</option>
<option value="%/12/2001">Dec</option>
</select>
</td>
</tr>
<tr>
<td width="20"><img src="../images/tran.gif" width="1"
height="5"></td>
<td colspan="3"><img src="../images/tran.gif" width="1"
height="5"></td>
</tr>
<tr>
<td width="20"> </td>
<td width="365"><font size="1">Now Showing:</font></td>
<td width="85"><font size="1">Sort By</font></td>
<td width="150">
<select name="sorting">
<option value="LastName">Last Name</option>
<option value="OrderDate">Order Date</option>
<option value="Invoicenumber">Invoice Number</option>
</select>
<input type="submit" name="Submit" value="go">
</td>
</tr>
<tr>
<%
dim formatdatref
if request("datref") = "%/%/2001" then
formatdatref = "All Records"
end if
if request("datref") = "%/01/2001" then
formatdatref = "January"
end if
if request("datref") = "%/02/2001" then
formatdatref = "February"
end if
if request("datref") = "%/03/2001" then
formatdatref = "March"
end if
if request("datref") = "%/04/2001" then
formatdatref = "April"
end if
if request("datref") = "%/05/2001" then
formatdatref = "May"
end if
if request("datref") = "%/06/2001" then
formatdatref = "June"
end if
if request("datref") = "%/07/2001" then
formatdatref = "July"
end if
if request("datref") = "%/08/2001" then
formatdatref = "August"
end if
if request("datref") = "%/09/2001" then
formatdatref = "September"
end if
if request("datref") = "%/10/2001" then
formatdatref = "October"
end if
if request("datref") = "%/11/2001" then
formatdatref = "November"
end if
if request("datref") = "%/12/2001" then
formatdatref = "December"
end if
if request("datref") = "" then
formatdatref = "All Records"
end if
%>
<td width="20"> </td>
<td colspan="2"><font size="2" class="headingblue"><span
class="fontbold"><%= formatdatref %></span></font> <font size="1"
class="content">Now Displaying
Customers Records <%=(Recordset1_first)%> to <%=(Recordset1_last)%
> of <font color="#990000"><b><%=(Recordset1_total)%></b></font>
</font></td>
<td width="150">
<select name="ordering">
<option value="ASC">ASC</option>
<option value="DESC">Descending</option>
</select>
</td>
</tr>
<tr>
<td width="20"><img src="../images/tran.gif" width="1"
height="5"></td>
<td colspan="3"><img src="../images/tran.gif" width="1"
height="5"></td>
</tr>
<tr>
<td width="20"> </td>
<td colspan="3">
<hr width="600" size="1" align="left">
</td>
</tr>
</table>
<table width="620" border="0" cellspacing="0" cellpadding="0"
align="left">
<tr>
<td width="20" class="fontbold"> </td>
<td colspan="3" class="fontbold" align="left"><font
size="1">Customer Name</font></td>
<td width="52" class="fontbold">
<div align="center"><font size="1">Order ID</font></div>
</td>
<td width="80" class="fontbold"><font size="1">Order Date</font></td>
<td width="70" class="fontbold"><font size="1">Ship Date</font></td>
<td width="70" class="fontbold">
<div align="right"><font size="1">Total </font></div>
</td>
<td width="70" class="fontbold"> </td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<tr>
<td width="20" class="fontbold" height="12"><img
src="../images/tran.gif" width="20" height="15"></td>
<td colspan="3" class="font" height="12" align="left"><A
HREF="displayorderdetails.asp?<%= "Invoicenumber=" &
Recordset1.Fields.Item("Invoicenumber").Value %>"><%
(Recordset1.Fields.Item("Title").Value)%> <%=(Recordset1.Fields.Item
("FirstName").Value)%> <%=(Recordset1.Fields.Item("LastName").Value)%
></A></td>
<td width="52" class="font" height="12" align="center"><%
(Recordset1.Fields.Item("invoicenumber").Value)%> </td>
<td width="80" class="font" height="12"><%= DoDateTime
((Recordset1.Fields.Item("orderdate").Value), 0, -1) %></td>
<td width="70" class="font" height="12"><%=(Recordset1.Fields.Item
("ShipDate").Value)%></td>
<td width="70" class="font" height="12" align="right">£<%=
FormatNumber((Recordset1.Fields.Item("GrandTotal").Value), 2, -2, -2, -2) %
></td>
<td width="70" class="font" height="12" align="right"><a
href="editorders.asp?<%= "Invoicenumber=" & Recordset1.Fields.Item
("Invoicenumber").Value %>">Edit</a>
| <a href="deleteorders.asp?<%= "Invoicenumber=" &
Recordset1.Fields.Item("Invoicenumber").Value %>">Delete</a></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
<tr>
<td width="20" class="fontbold" height="12"> </td>
<td width="35" class="font" height="12" align="left"> </td>
<td width="100" class="font" height="12"> </td>
<td width="70" class="font" height="12"> </td>
<td width="52" class="font" height="12"> </td>
<td width="80" class="font" height="12"> </td>
<td width="70" class="font" height="12"> </td>
<td width="70" class="font" height="12"> </td>
<td width="70" class="font" height="12"> </td>
</tr>
<tr>
<td colspan="9" class="fontbold" height="12">
<table width="620" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><img src="../images/tran.gif" width="1"
height="8"></td>
</tr>
<tr>
<td width="20"><br>
</td>
<td>
<hr noshade size="1">
</td>
</tr>
<tr>
<td width="20"> </td>
<td class="font">
<%
TM_counter = 0
For i = 1 to Recordset3_total Step MM_size
TM_counter = TM_counter + 1
TM_PageEndCount = i + MM_size - 1
if TM_PageEndCount > Recordset3_total Then TM_PageEndCount =
Recordset3_total
if i <> MM_offset + 1 then
Response.Write("<a href=""" & Request.ServerVariables("URL") & "?" &
MM_keepMove & "offset=" & i-1 & """>")
Response.Write(TM_counter & "</a>")
else
Response.Write("<b>" & TM_counter & "</b>")
end if
if(TM_PageEndCount <> Recordset3_total) then Response.Write("|")
next
%>
<% If Not MM_atTotal Then %>
<a href="<%=MM_moveNext%>">Next>></a>
<% End If ' end Not MM_atTotal %>
</td>
</tr>
<tr>
<td width="20"> </td>
<td> </td>
</tr>
<tr>
<td width="20"> </td>
<td>
<hr noshade size="1">
</td>
</tr>
<tr>
<td width="20"> </td>
<td>
<table width="226" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="70"><a href="javascript:history.go(-1)"
onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage
('Image20','','../images/b_back2.gif',1)"><img name="Image20" border="0"
src="../images/b_back1.gif" width="68" height="16"></a></td>
<td width="5"> </td>
<td width="67"><a href="JavaScript: onclick=window.print
()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage
('Image21','','../images/b_print2.gif',1)"><img name="Image21" border="0"
src="../images/b_print1.gif" width="65" height="16"></a></td>
<td width="5"> </td>
<td width="70"><a href="admin.asp"
onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage
('Image18','','../images/b_home2.gif',1)"><img name="Image18" border="0"
src="../images/b_home1.gif" width="65" height="16"></a></td>
<td width="10"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="20"> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
<%
Recordset1.Close()
%>
thanks very much
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 21 Aug 2001 11:08:45 +1000
|
|
You expect us to search through the *729* lines of code you provided to try
and find your error?!?
Perhaps you could read this instead:
http://www.adopenstatic.com/personal/help.asp
(which is my take on the matter - I don't speak for anyone else on the list)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <taherm@f...>
Subject: [asp_web_howto] page doesnt work when uploaded to the server
: my page works fine when viewed locally but when uploaded to the server,
: only some all the features work except for one.
: plz visit my site at
: http://216.119.79.214/phones/www/admin/displayorders.asp
:
: when you select august from drop down menu it displays no records for taht
: month which is wrong. the code for that page is as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |