I created, using some borrowed code, an asp search page for our intranet. I'm using frontpage 2003. When I publish I get that complation error on different lines at different times. They all seem to do with end if and elseif statements. The last one is from line 118. I highligted it. The code below is: - <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
-
<HTML>
-
<HEAD>
-
-
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
-
<!--
-
option explicit
-
-->
-
</SCRIPT>
-
-
<TITLE>Index Server Search Form</TITLE>
-
-
<META NAME="DESCRIPTION" CONTENT="Sample ASP query form for
-
Microsoft Index Server">
-
<META NAME="KEYWORDS" CONTENT="query, content, hit, asp">
-
<META NAME="MS.LOCALE" CONTENT="EN-US">
-
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
-
charset=Windows-1252">
-
<%
-
NewQuery = FALSE
-
UseSavedQuery = FALSE
-
QueryForm = Request.ServerVariables( "PATH_INFO" )
-
SearchString = ""
-
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
-
SearchString = Request.Form("SearchString")
-
pg = Request.Form("pg")
-
-
if pg <> "" then
-
NextPageNumber = pg
-
NewQuery = FALSE
-
UseSavedQuery = TRUE
-
else
-
NewQuery = SearchString <> ""
-
end if
-
end if
-
-
%>
-
</HEAD>
-
<meta name="Microsoft Border" content="t">
-
<TABLE>
-
<TR>
-
<TD><H1>LFG Search Form</H1></TD>
-
</TR>
-
</TABLE>
-
-
<HR WIDTH=75% ALIGN=center SIZE=3>
-
<p>
-
-
<TABLE>
-
<TR>
-
<TD ALIGN=LEFT>Enter your query below:</TD>
-
</TR>
-
<TR>
-
<TD>
-
<FORM ACTION="<%= QueryForm%>" METHOD=POST>
-
-
<TABLE>
-
<TR>
-
<TD><INPUT TYPE="TEXT" NAME="SearchString" SIZE="60"
-
MAXLENGTH="100" VALUE="<%=SearchString%>"></TD>
-
<TD><INPUT TYPE="SUBMIT" NAME="Action" VALUE="New Query"></TD>
-
</TR>
-
</TABLE>
-
-
</FORM>
-
</TD>
-
</TR>
-
</TABLE>
-
<BR>
-
-
<%
-
-
if SearchString <> "" then
-
if NewQuery then
-
set Session("Query") = nothing
-
set Session("Recordset") = nothing
-
NextRecordNumber = 1
-
-
set Q = Server.CreateObject("ixsso.Query")
-
set util = Server.CreateObject("ixsso.util")
-
Q.Query = SearchString
-
Q.SortBy = "rank[d]"
-
Q.Columns = "DocTitle, vpath, path, filename, size, write, characterization"
-
util.AddScopeToQuery Q, ""
-
-
set RS = Q.CreateRecordSet("nonsequential")
-
-
RS.PageSize = 10
-
ActiveQuery = TRUE
-
-
elseif UseSavedQuery then
-
if IsObject( Session("Query") ) And IsObject( Session("RecordSet") ) then
-
set Q = Session("Query")
-
set RS = Session("RecordSet")
-
*********(line118) if RS.RecordCount <> -1 and NextPageNumber <> -1 *******then RS.AbsolutePage = NextPageNumber
-
NextRecordNumber = RS.AbsolutePosition
-
end if
-
-
ActiveQuery = TRUE
-
else
-
Response.Write "ERROR - No saved query"
-
end if
-
end if
-
%>
-
<p>
-
<HR width="80%" ALIGN=center SIZE=3>
-
<p>
-
-
<%
-
LastRecordOnPage = NextRecordNumber + RS.PageSize - 1
-
CurrentPage = RS.AbsolutePage
-
if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPage then
-
LastRecordOnPage = RS.RecordCount
-
end if
-
-
Response.Write "Documents " & NextRecordNumber & " to " & LastRecordOnPage
-
if RS.RecordCount <> -1 then
-
Response.Write " of " & RS.RecordCount
-
end if
-
Response.Write " matching the query " & chr(34) & "<I>"
-
Response.Write SearchString & "</I>" & chr(34) & ".<P>"
-
%>
-
<dl>
-
-
<!-- BEGIN first row of query results table -->
-
<% Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage %>
-
-
<%
-
' This is the detail portion for Title, Abstract, URL, Size, and
-
' Modification Date.
-
-
' If there is a title, display it, otherwise display the virtual path.
-
%>
-
<p>
-
<dt><%= NextRecordNumber%>.
-
<%if VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" then%>
-
<b><a href="<%=RS("vpath")%>"><%= Server.HTMLEncode( RS("filename") )%></a></b>
-
<%else%>
-
<b><a href="<%=RS("vpath")%>"><%= Server.HTMLEncode(RS("DocTitle"))%></a></b>
-
<%end if%>
-
<dd>
-
<%if VarType(RS("characterization")) = 8 and RS("characterization") <> "" then%>
-
<b><i>Abstract: </I></b><%= Server.HTMLEncode(RS("characterization"))%>
-
<br>
-
<%end if%>
-
<cite>
-
<a href="http://lf04/">http://LF04</a>
-
<font size=-1> - <%if RS("size") = "" then%>(size and time unknown)<%else%>size <%=RS("size")%> bytes - <%=RS("write")%> GMT<%end if%></font>
-
</cite>
-
-
<%
-
RS.MoveNext
-
NextRecordNumber = NextRecordNumber+1
-
Loop
-
%>
-
-
</dl>
-
<P><BR>
-
-
<%
-
else ' NOT RS.EOF
-
if NextRecordNumber = 1 then
-
Response.Write "No documents matched the query<P>"
-
else
-
Response.Write "No more documents in the query<P>"
-
end if
-
-
end if ' NOT RS.EOF
-
%>
-
-
<!-- If the index is out of date, display the fact -->
-
-
<%if Q.OutOfDate then%>
-
<P>
-
<I><B>The index is out of date.</B></I><BR>
-
<%end if%>
-
-
<!--
-
If the query was not executed because it needed to enumerate to
-
resolve the query instead of using the index, but AllowEnumeration
-
was FALSE, let the user know
-
-->
-
-
<%if Q.QueryIncomplete then%>
-
<P>
-
<I><B>The query is too expensive to complete.</B></I><BR>
-
<%end if%>
-
-
<!--
-
If the query took too long to execute (for example, if too much work
-
was required to resolve the query), let the user know
-
-->
-
-
<%if Q.QueryTimedOut then%>
-
<P>
-
<I><B>The query took too long to complete.</B></I><BR>
-
<%end if%>
-
<TABLE>
-
-
<!--
-
This is the "previous" button.
-
This retrieves the previous page of documents for the query.
-
-->
-
-
<%SaveQuery = FALSE%>
-
<%if CurrentPage > 1 and RS.RecordCount <> -1 then%>
-
<td align=left>
-
<form action="<%= QueryForm%><INPUT TYPE="HIDDEN" NAME="SearchString" VALUE="<%=SearchString%>"><INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage-1%>" ><input type="submit" value="Previous <%=RS.PageSize%> documents">
-
</form>
-
</td>
-
<%SaveQuery = TRUE%>
-
<%end if%>
-
-
<!--
-
This is the "next" button.
-
This button retrieves the next page of documents for the query.
-
If the RS.RecordCount is available, the number of
-
documents on the next page will be displayed.
-
-->
-
-
<%if Not RS.EOF then%>
-
<td align=right>
-
<form action="<%= QueryForm%>" method="POST">
-
<INPUT TYPE="HIDDEN" NAME="SearchString" VALUE="<%=SearchString%>">
-
<INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage+1%>" >
-
-
<% NextString = "Next "
-
if RS.RecordCount <> -1 then
-
NextSet = (RS.RecordCount - NextRecordNumber) + 1
-
if NextSet > RS.PageSize then
-
NextSet = RS.PageSize
-
end if
-
NextString = NextString & NextSet & " documents"
-
else
-
NextString = NextString & " page of documents"
-
end if
-
%>
-
<input type="submit" value="<%=NextString%>">
-
</form>
-
</td>
-
<%SaveQuery = TRUE%>
-
<%end if%>
-
-
</TABLE>
-
-
-
<!-- Display the page number -->
-
-
Page <%=CurrentPage%><%if RS.PageCount <> -1 then
-
Response.Write " of " & RS.PageCount
-
end if %><%
-
' If either of the previous or back buttons were displayed, save the query
-
' and the recordset in session variables.
-
if SaveQuery then
-
set Session("Query") = Q
-
set Session("RecordSet") = RS
-
else
-
RS.close
-
Set RS = Nothing
-
Set Q = Nothing
-
set Session("Query") = Nothing
-
set Session("RecordSet") = Nothing
-
end if
-
%><% end if
-
-
elseif not NewQuery then
-
Response.Write ""
-
else
-
Response.Write "Please enter a word or phrase to search for."
-
end if
-
-
%>
5 2482 jhardman 3,406
Recognized Expert Specialist
I created, using some borrowed code, an asp search page for our intranet. I'm using frontpage 2003. When I publish I get that complation error on different lines at different times. They all seem to do with end if and elseif statements. The last one is from line 118. I highligted it. The code below is: - ...
-
*********(line118) if RS.RecordCount <> -1 and NextPageNumber <> -1 *******then RS.AbsolutePage = NextPageNumber
-
...
I thought when I first looked at your code that you had mis-copied this line because it should not look like this. It is possible that the code has been edited with something that put line breaks in inappropriate places, but most of the code looks well-documented and well-written. Anyway, there are a couple of different ways if statements can be written depending on programmer preference and need. It could be all onone line like this: - IF condition THEN response
or split into multiple lines like this: - IF condition THEN
-
response
-
end if
It appears that the "then" was put on the next line of your code here, but it should not be. It looks like your code is supposed to be this: - if RS.RecordCount <> -1 and NextPageNumber <> -1 then
-
RS.AbsolutePage = NextPageNumber
-
'a couple other lines
-
end if
I didn't try to run and read through all of your code, so there could easily be other problems. see if you can work it out, or ask me again.
Jared
Adding the different lines actually corrected that problem. Thank you so very much. I got my search box, but received another error like the one before only different.
The code is
the error is this
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/search/default.asp, line 93
I have no idea were a tic would go. Would this be a reference problem?
jhardman 3,406
Recognized Expert Specialist
Adding the different lines actually corrected that problem. Thank you so very much. I got my search box, but received another error like the one before only different.
The code is
the error is this
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/search/default.asp, line 93
I have no idea were a tic would go. Would this be a reference problem?
This probably means that there are now too many "end if"s. This would indicate that the whole script is now pretty convoluted. Try to figure out which "end if" corresponds to which "if" (nice even tabbing helps here) and you should be able to spot the problem.
Jared
You were correct again. Thank you. I had great tests, Was having an issue with the previous page coding. Now I'm getting an error on an IF for a line where there is not IF. I'm ready to give this up.
jhardman 3,406
Recognized Expert Specialist
You were correct again. Thank you. I had great tests, Was having an issue with the previous page coding. Now I'm getting an error on an IF for a line where there is not IF. I'm ready to give this up.
I know the feeling. Once I went through something very similar to this and found that I had commented out a line that had an ASP delimiter in it, and had forgotten that of course the delimiter was still being recognized even though it was in a comment. It took me forever to find the problem.
The best advice I can give is go through the code and systematically place tab stops when you enter an if statement or a loop etc, then eventually you should see where the structure was lost.
The other option is to start over. If you don't even know where the error is, that might be a good idea.
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Matthew Louden |
last post by:
I have no idea what's wrong with the following ASP statement:
Response.Write "<select name=\"id\">"
MS VBScript Compilation error 800a0401
expected end of statement
However, if I do the following, it will be fine:
<select name="id">
|
by: Matt |
last post by:
When the ASP statement end with a _ character, then the next line cannot
have comment ' character. Is that correct? Since I encountered the following
error:
Microsoft VBScript compilation (0x800A0400)
Expected statement
sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES (" _
' & 2 & "," _
& beginhour & "," _
|
by: Adam Short |
last post by:
Can anyone help?
I have all of a sudden started to receive this error on my site!
I have no idea what script it is executing, why it is now failing, what is
going on??
All I have been able to find out is that Microsoft has had the same problem
on their site!
|
by: Adam Short |
last post by:
Can anyone help?
I have all of a sudden started to receive this error on my site!
I have no idea what script it is executing, why it is now failing, what is
going on??
All I have been able to find out is that Microsoft has had the same problem
on their site!
|
by: aklsdjfh |
last post by:
I'm no expert in asp and vbscript but not a total beginner. I've got some
VBScript in an asp page which is generating a forumla for use in Lotus Notes
replication.
The line that it is objecting to is
<% if user2 <> "" then response.write("| @IsMember("" & LCase(user2) &
"";@LowerCase(@Name(;AssignedTo)))") end if %>
i.e. if the string user2 is "Mike" I expect the HTML to be
|...
| |
by: sonasiva |
last post by:
{asp code}
Error Type:
Microsoft VBScript compilation (0x800A03EE)
Expected ')'
/web/company_ind.asp, line 35, column 37
Response.Write(objrs("investor_name")""<a href=""investor_ind.asp?investor_name="&objrs("investor_name")&""">"</a>"
|
by: remya1000 |
last post by:
While running the program, i'm getting this error
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/admin/currentmonth.asp, line 26
strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted, InvoiceDetail.Quantity, InvoiceDetail.Description, InvoiceDetail.ExtendedPrice, InvoiceInfo.GST, InvoiceInfo.PST, InvoiceInfo.Total FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN...
|
by: char |
last post by:
I can't figure out why I am getting error: Microsoft VBScript compilation '800a0400'
SET MyRecordSet = SERVER.CREATEOBJECT("ADODB.RECORDSET")
MySQL = "SELECT * FROM ShipSummary (NOLOCK) where ShipDate = DateDiff(d, 0, GetDate()+1)"
MyRecordSet.OPEN MySQL, XXXXXX
if not MyRecordSet.eof then
MyArray = MyRecordSet.GETROWS()
MyRecordSet.CLOSE
FOR MyCursor = LBOUND(MyArray,2) TO UBOUND(MyArray,2)
|
by: Indy |
last post by:
Hi,
I am new to VB and have some previous programming experiences.
Curently working as an IT support person and trying to write a VB 6 script to access apos database and get one of the table's field value.
I think this is not that hard for a experience VB programmer, but I am kind a stuggling.
Can any one have a similler code for this task?
When I am compling my code I am getting an error in the first line.
|
by: kevinr |
last post by:
Hi, I am brand new to VB, and I am trying to deploy Office 2007 on my network here at work. We used part of this script to do another deployment, and I have taken pieces and tried to edit for this deployment. I know I am probably way off the mark, but I would appreciate any help. This is the initial error I receive when running the script.
C:\bkuptestpc\kr_migrate.vbs(276, 1) Microsoft VBScript compilation error: Expected 'End'
Exit code: 1 ,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |