 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 15th, 2004, 01:32 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
(0x800A03F6) Expected 'End'
Hi and thank you for any assistance you can offer. I have a page that is giving me this error
Error Type:
Microsoft VBScript compilation (0x800A03F6)
Expected 'End'
/websters/TMPjxnljw8mkq.asp, line 342
I am not sure where to start as I know nicks about ASP, just what DWMX is feeding me and another bloke who has been tinkering with it. The script is.....
<%@LANGUAGE="VBSCRIPT"%>
<%
Dim rsrelist__MMColParam
rsrelist__MMColParam = "Sold"
If (Request("MM_EmptyValue") <> "") Then
rsrelist__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsrelist
Dim rsrelist_numRows
Set rsrelist = Server.CreateObject("ADODB.Recordset")
rsrelist.ActiveConnection = MM_websters_STRING
rsrelist.Source = "SELECT * FROM cars WHERE List = '" + Replace(rsrelist__MMColParam, "'", "''") + "' ORDER BY Stock ASC"
rsrelist.CursorType = 0
rsrelist.CursorLocation = 2
rsrelist.LockType = 1
rsrelist.Open()
rsrelist_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 10
Repeat1__index = 0
rsrelist_numRows = rsrelist_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rsrelist_total
Dim rsrelist_first
Dim rsrelist_last
' set the record count
rsrelist_total = rsrelist.RecordCount
' set the number of rows displayed on this page
If (rsrelist_numRows < 0) Then
rsrelist_numRows = rsrelist_total
Elseif (rsrelist_numRows = 0) Then
rsrelist_numRows = 1
End If
' set the first and last displayed record
rsrelist_first = 1
rsrelist_last = rsrelist_first + rsrelist_numRows - 1
' if we have the correct record count, check the other stats
If (rsrelist_total <> -1) Then
If (rsrelist_first > rsrelist_total) Then
rsrelist_first = rsrelist_total
End If
If (rsrelist_last > rsrelist_total) Then
rsrelist_last = rsrelist_total
End If
If (rsrelist_numRows > rsrelist_total) Then
rsrelist_numRows = rsrelist_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (rsrelist_total = -1) Then
' count the total records by iterating through the recordset
rsrelist_total=0
While (Not rsrelist.EOF)
rsrelist_total = rsrelist_total + 1
rsrelist.MoveNext
Wend
' reset the cursor to the beginning
If (rsrelist.CursorType > 0) Then
rsrelist.MoveFirst
Else
rsrelist.Requery
End If
' set the number of rows displayed on this page
If (rsrelist_numRows < 0 Or rsrelist_numRows > rsrelist_total) Then
rsrelist_numRows = rsrelist_total
End If
' set the first and last displayed record
rsrelist_first = 1
rsrelist_last = rsrelist_first + rsrelist_numRows - 1
If (rsrelist_first > rsrelist_total) Then
rsrelist_first = rsrelist_total
End If
If (rsrelist_last > rsrelist_total) Then
rsrelist_last = rsrelist_total
End If
End If
%>
<%
set rsrelist = server.CreateObject("ADODB.Recordset")
rsrelist.activeConnection = MM_websters_STRING
if(Request.Form("Submit") <> "")then
search = false
sqlQuery = "SELECT * FROM cars WHERE"
if(Request.Form("Make") <> "")then
search = true
sqlQuery = sqlQuery & " Make='" & replace(Request.Form("Make"),"'","''") & "'"
end if
if(Request.Form("Model") <> "")then
search = true
sqlQuery = sqlQuery & " Model='" & replace(Request.Form("Model"),"'","''") & "'"
end if
if(Request.Form("Year") <> "")then
search = true
sqlQuery = sqlQuery & " Year='" & replace(Request.Form("Year"),"'","''") & "'"
end if
if(Request.Form("Rego") <> "")then
search = true
sqlQuery = sqlQuery & " Registration='" & replace(Request.Form("Rego"),"'","''") & "'"
end if
if(Request.Form("Engine") <> "")then
search = true
sqlQuery = sqlQuery & " Engine='" & replace(Request.Form("Engine"),"'","''") & "'"
end if
if(Request.Form("Stock") <> "")then
search = true
sqlQuery = sqlQuery & " Stock='" & replace(Request.Form("Stock"),"'","''") & "'"
end if
if(search)then
rsrelist.Open sqlQuery
else
rsrelist.Open "SELECT * FROM CARS"
end if
else
tempQuery = "SELECT * FROM cars"
rsrelist.Open tempQuery
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Relist Webster's Vehicles</TITLE>
<meta content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<style type="text/css"><!--
body { margin: 0px; padding: 0px; }
-->
</style>
<script language="JavaScript" type="text/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_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_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];}
}
function GP_AdvOpenWindow(theURL,winName,features,popWidth, popHeight,winAlign,ignorelink,alwaysOnTop,autoClos eTime,borderless) { //v2.0
var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;
if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth;
if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0;
features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
if (window["popupWindow"] == null) window["popupWindow"] = new Array();
var wp = popupWindow.length;
popupWindow[wp] = window.open(theURL,winName,features);
if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;
if (document.all || document.layers || document.getElementById) {
if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
if (alwaysOnTop && alwaysOnTop != "") {
ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
if (autoCloseTime && autoCloseTime > 0) {
popupWindow[wp].document.body.onbeforeunload = function() {
if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
window.onbeforeunload = null; }
autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }
document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}
//-->
</script>
</HEAD>
<BODY bgcolor="#EEEEEE" leftMargin=0 topMargin=0 marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/butadminf2.gif','images/helpf2.gif')">
<TABLE
width="100%" background="images/tophead-1.gif">
<TBODY>
<TR>
<TD>
<CENTER>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=750>
<TBODY>
<TR><TD width=183 vAlign=top><div align="center"><img src="images/wpwp-1.jpg" width="127" height="70"></div>
</TD>
<TD width="284" vAlign=top><div align="center"><img src="images/wpc-w.gif" width="280" height="70"></div>
</TD>
<TD width="283" vAlign=top><div align="center"><img src="images/500sl.gif" width="199" height="90"></div>
</TD>
</TR>
</TBODY>
</TABLE>
</CENTER>
</TD>
</TR>
</TBODY>
</TABLE>
<CENTER>
<h3><strong>RELIST
VEHICLES</strong></h3>
<p><strong><a href="admin.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('admin111','','images/butadminf2.gif',1)"><img src="images/butadmin.gif" alt="Back To Admin Control" name="admin111" width="112" height="25" border="0" id="admin1"></a></strong></p>
<p><strong><a href="#" onClick="GP_AdvOpenWindow('help.htm','help','fulls creen=no,toolbar=no,location=no,status=no,menubar= no,scrollbars=yes,resizable=no',500,400,'center',' ignoreLink','',0,'');return document.MM_returnValue" onMouseOver="MM_swapImage('help','','images/helpf2.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="images/help.gif" alt="Help & Info" name="help" width="12" height="17" border="0"></a></strong></p>
<form action="relist_vehicles.asp" method="post" name="search" id="search">
<table width="720" border="0" cellpadding="5" cellspacing="0" bgcolor="#020267">
<tr valign="top">
<td><div align="center"><strong>Make</strong></div></td>
<td><div align="center"><strong>Model</strong></div></td>
<td><div align="center"><strong>Year</strong></div></td>
<td><div align="center"><strong>Reg
No.</strong></div></td>
<td><div align="center"><strong>Engine
No.</strong></div></td>
<td><div align="center"><strong>Stock
No.</strong></div></td>
</tr>
<tr>
<td><div align="center"><input name="Make" type="text" id="Make" size="20">
</div></td>
<td><div align="center">
<input name="Model" type="text" id="Model" size="20">
</div></td>
<td><div align="center">
<input name="Year" type="text" id="Year" size="6">
</div></td>
<td><div align="center">
<input name="Rego" type="text" id="Rego" size="10">
</div></td>
<td><div align="center">
<input name="Engine" type="text" id="Engine" size="20">
</div></td>
<td><div align="center">
<input name="Stock" type="text" id="Stock" size="6">
</div></td>
</tr>
<tr>
<td colspan="6"><div align="center">
<input type="submit" name="Submit" value="Search">
</div></td>
</tr>
</table>
</form>
<%
if(rsrelist.EOF)then
response.write("<center>No vehicles found.</center>")
else
%>
<table width="720" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td align="left" valign="top"><table width="720" border="0" cellpadding="5" cellspacing="0">
<tr valign="top" bgcolor="#020267">
<td width="120"><div align="center"><strong>Make</strong></div>
</td>
<td width="116"><div align="center"><strong>Model</strong></div>
</td>
<td width="116"><div align="center"><strong>Year</strong></div>
</td>
<td width="116"><div align="center"><strong>Reg
Number</strong></div>
</td>
<td width="116"><div align="center"><strong>Engine Number</strong></div>
</td>
<td width="116"><div align="center"><strong>Stock
Number</strong></div>
</td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsrelist.EOF))
%>
<tr valign="top" bgcolor="#CCCCCC">
<td colspan="6"><div align="center"><A HREF="edit_vehicle.asp?<%="ID=" & rsrelist.Fields.Item("ID").Value %>">Edit?</A> <A HREF="delete_vehicle.asp?<%="ID=" & rsrelist.Fields.Item("ID").Value %>">Delete?</A></div>
</td>
</tr>
<tr valign="top" bgcolor="#FFFFFF">
<td><div align="center"> <%=(rsrelist.Fields.Item("Mak e").Value)%></div>
</td>
<td><div align="center"><%=(rsrelist.Fields.Item("Model").V alue)%> </div>
</td>
<td><div align="center"> <%=(rsrelist.Fields.Item("Yea r").Value)%></div>
</td>
<td><div align="center"><%=(rsrelist.Fields.Item("Registrat ion").Value)%></div>
</td>
<td><div align="center"><%=(rsrelist.Fields.Item("Engine"). Value)%> </div>
</td>
<td><div align="center"><%=(rsrelist.Fields.Item("Stock").V alue)%></div>
</td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsrelist.MoveNext()
Wend
%>
<tr valign="top" bgcolor="#020267">
<td height="2" colspan="6"></td>
</tr>
</table></td>
</tr>
</table>
<p>showing vehicle <%=(rsrelist_first)%> to <%=(rsrelist_last)%> of <%=(rsrelist_total)%></p>
<p> <img src="images/previous.gif" alt="Previous Vehicles" name="Previous" width="125" height="15" border="0"> <img src="images/next.gif" alt="Next Vehicles" name="next" width="97" height="15" border="0"> </p>
<p><strong><a href="admin.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('admin11','','images/butadminf2.gif',1)"><img src="images/butadmin.gif" alt="Back To Admin Control" name="admin11" width="112" height="25" border="0" id="admin1"></a></strong></p>
<p> </p>
</CENTER></BODY></HTML>
<%
rsrelist.Close()
Set rsrelist = Nothing
%>
Thanks again to anyone that can help
Cheers
Lance
|
|

April 15th, 2004, 02:04 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Lance,
What line is line number 342? It's a bit too much to count them and track down the error by hand ;)
The problem is probably caused by a missing End If. E.g.:
If BlaBla Then
If MoreBla Then
End If
This code would cause that error because one of the If blocks is not closed correctly.
In your code, this code block is probably causing the problem:
if(rsrelist.EOF)then
response.write("<center>No vehicles found.</center>")
else
AFAICS, there is no matching End If block.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Into the Death by Atari Teenage Riot (Track 2 from the album: Delete Yourself)
|
|

April 15th, 2004, 02:26 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your help Imar. The line is second from the bottom and says:
Set rsrelist = Nothing
Sorry about not giving the line number.
Cheers
Lance
|
|

April 15th, 2004, 02:53 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yeah, no problem.
The thing is, it's hard for me to determine where you should put the End If. I think it should be here:
Code:
<p><strong><a href="admin.asp" onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('admin11','','images/butadminf2.gif',1)"><img
src="images/butadmin.gif" alt="Back To Admin Control" name="admin11"
width="112" height="25" border="0"
id="admin1"></a></strong></p>
<% End If %>
<p> </p>
</CENTER></BODY></HTML>
This way, the navigation table at the end is displayed when the
recordset contains at least one record, while the closing </body>
tags are displayed regardless the number of records in the recordset.
<plug type="ShameLess">
If you want to learn more about this, you should take a look
at " Beginning Dreamweaver MX 2004", published by Wrox. It deals with all
this stuff, like Recordsets, Repeating Tables, Navigation Bars etc
in great detail. I am a bit biased because I am one of the authors,
but I think this book would really fit into the things you're doing
right now.
</plug type="ShameLess">
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Teen Age Riot by Sonic Youth (Track 1 from the album: Daydream Nation)
|
|

April 15th, 2004, 03:13 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Imar. That fixed the problem.Your book sounds like just what I need. I had a look at the link you provided.
Cheers
Lance
|
|

April 15th, 2004, 04:10 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You're welcome. Glad it's working now.
Due to the amount of code that Dreamweaver generates, a page like this is sometimes hard to debug.... ;)
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Gasoline by Audioslave (Track 3 from the album: Audioslave)
|
|
 |