Fejl på min søgeside
Hej AlleJeg er igang med at lave en søgeside, hvor man kan søge på flere ord og i forskellige kategorier.
Men når jeg kører siden får jeg fejl med en "End If" sætning...
Er der nogen der kan se hvor fejlen ligger, jeg har stirret mig blind på det - jeg har sat en bemærkning der hvor fejlen forekommer
Fulde kode:
-----------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../../Connections/Dblite.asp" -->
<%
Keywords = Request("txtKeywords")
MatchType = Request("SelMatchType")
If Keywords <> "" Then
SearchFields = "CombinedFields"
Keywords = Replace(Keywords, "'","''")
If (MatchType <> "EXACT") Then
Keywords = Replace(Keywords, ","," ")
Keywords = Replace(Keywords, ":"," ")
Keywords = Replace(Keywords, ";"," ")
Keywords = Replace(Keywords, "-"," ")
Keywords = Replace(Keywords, "_"," ")
Keywords = Replace(Keywords, "/"," ")
Keywords = Replace(Keywords, "\"," ")
WhereKeywordsString = " WHERE " & SearchFields & " LIKE '%"
SearchArray = Split(Keywords," ")
For i = 0 to Ubound(SearchArray)
If i > 0 Then
WhereKeywordsString = WhereKeywordsString & " " & MatchType & " " & SearchFields & " LIKE '%" & SearchArray(i) & "%'"
Else
WhereKeywordsString = WhereKeywordsString & SearchArray(i) & "%'"
End If
Next
Else
WhereKeywordsString = " WHERE CombinedFields LIKE '%" & Keywords & "%'"
End If
%>
<%
set rsQryCombinedFields = Server.CreateObject("ADODB.Recordset")
rsQryCombinedFields.ActiveConnection = MM_Dblite_STRING
rsQryCombinedFields.Source = "SELECT DISTINCT DocumentID FROM QryCombinedFields" & WhereKeywordsString
rsQryCombinedFields.CursorType = 0
rsQryCombinedFields.CursorLocation = 2
rsQryCombinedFields.LockType = 3
rsQryCombinedFields.Open()
rsQryCombinedFields_numRows = 0
%>
<%
If ((Not rsQryCombinedFields.BOF) Or (Not rsQryCombinedFields.EOF)) Then
DocumentString =(rsQryCombinedFields.Fields.Item("DocumentID").Value)
rsQryCombinedFields.MoveNext()
While NOT rsQryCombinedFields.EOF
ThisDocumentID =(rsQryCombinedFields.Fields.Item("DocumentID").Value)
DocumentString = DocumentString & "," & ThisDocumentID
rsQryCombinedFields.MoveNext()
Wend
rsQryCombinedFields.Close()
End If
IF DocumentString <>"" Then
sqlString =" WHERE DocumentID IN (" & DocumentString & ")"
Else
DontDo = 1
End If
Else
sqlString = "WHERE DocumentID <> -1"
End If
%>
<%
If DontDo <> 1 Then
Category = Request("selCategory")
SortString = (Request("selSortBy")) & (Request("radDirection"))
End If
If Category <> "-1" Then
AndCategoryString = " AND CategoryID = " & Category
Else
AndCategoryString = ""
End If
sqlString = sqlString & AndCategoryString & SortString
%>
<%
set rsQryDisplayFields = Server.CreateObject("ADODB.Recordset")
rsQryDisplayFields.ActiveConnection = MM_Dblite_STRING
rsQryDisplayFields.Source = "SELECT DISTINCT DocumentID, Description, DocName FROM QryDisplayFields " & sqlString
rsQryDisplayFields.CursorType = 0
rsQryDisplayFields.CursorLocation = 2
rsQryDisplayFields.LockType = 3
rsQryDisplayFields.Open()
rsQryDisplayFields_numRows = 0
%>
<%
Dim Repeat2__numRows
Repeat2__numRows = 10
Dim Repeat2__index
Repeat2__index = 0
rsQryDisplayFields_numRows = rsQryDisplayFields_numRows + Repeat2__numRows
%>
<%
If Not rsQryDisplayFields.EOF Or Not rsQryDisplayFields.BOF Then
DoDo = 1
rsQryDisplayFields_total = rsQryDisplayFields.RecordCount
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)
End If
End If ' I DENNE LINIE FÅR JEG FEJLEN
%>
<html>
<head>
<title>Search result</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="620" border="0" cellspacing="20" cellpadding="0" align="center">
<tr>
<td><b><font size="+1">Results</font></b></td>
</tr>
</table>
<table width="620" border="0" cellspacing="10" cellpadding="0" align="center" height="60">
<tr>
<td height="78" valign="top">
<% If DontDo <> 1 Then
<% If Not rsQryDisplayFields.EOF Or Not rsQryDisplayFields.BOF Then %>
<table width="100%" border="1" cellspacing="0" cellpadding="5">
<tr>
<td width="30%" class="SearcHeaders"><b><font size="-1">Category</font></b></td>
<td width="50%" class="SearcHeaders"><b><font size="-1">Sitename</font></b></td>
</tr>
<%
If DontDo <> 1 Then
While ((Repeat2__numRows <> 0) AND (NOT rsQryDisplayFields.EOF))
%>
<tr>
<td><font size="-1" face="Arial, Helvetica, sans-serif"><%=(rsQryDisplayFields.Fields.Item("Description").Value)%></font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif"><A HREF="/GlobalResources/scripts/details.asp?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "DocumentID=" & rsQryDisplayFields.Fields.Item("DocumentID").Value %>"><%=(rsQryDisplayFields.Fields.Item("DocName").Value)%></A></font></td>
</tr>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
rsQryDisplayFields.MoveNext()
Wend
End If
%>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="10">
<tr>
<td><div align="center">
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"> <strong>
<% If MM_offset <> 0 Then %>
<font size="-1" face="Arial, Helvetica, sans-serif"><a href="<%=MM_moveFirst%>">First</a>
<% End If ' end MM_offset <> 0 %>
</strong></td>
<td width="31%" align="center"> <strong>
<% If MM_offset <> 0 Then %>
<font size="-1" face="Arial, Helvetica, sans-serif"><a href="<%=MM_movePrev%>">Previous</a>
<% End If ' end MM_offset <> 0 %>
</strong></td>
<td width="23%" align="center"> <strong>
<% If Not MM_atTotal Then %>
<font size="-1" face="Arial, Helvetica, sans-serif"><a href="<%=MM_moveNext%>">Next</a>
<% End If ' end Not MM_atTotal %>
</strong></td>
<td width="23%" align="center"> <strong>
<% If Not MM_atTotal Then %>
<font size="-1" face="Arial, Helvetica, sans-serif"><a href="<%=MM_moveLast%>">Last</a>
<% End If ' end Not MM_atTotal %>
</strong></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td><div align="center"><strong><font size="-1" face="Arial, Helvetica, sans-serif"> Records <%=(rsQryDisplayFields_first)%> to <%=(rsQryDisplayFields_last)%> of <%=(rsQryDisplayFields_total)%> </font></strong></div></td>
</tr>
</table>
<% End If
End If %>
<% If DontDo = 1 OR DoDo <> 1 Then
<table width="100%" border="0">
<% If rsQryDisplayFields.EOF And rsQryDisplayFields.BOF Then %>
<tr>
<td><strong><font size="-1" face="Arial, Helvetica, sans-serif">Sorry no data found! </font></strong></td>
</tr>
<% End If %>
</table></td>
</tr>
</table>
</body>
</html>
<%
rsQryCombinedFields.Close()
%>
<%
If DontDo <> 1 Then
rsQryDisplayFields.Close()
End If
%>
-----------------
Håber der er nogen der kan hjælp mig :o)
På forhånd tak...
