如何解决 IIS中 index server实现中文输入查询功能。紧急救火!!

helanxue 2000-05-18 10:36:00
我在改造MICROSOFT提供的查询范例时,结果进行中文输入查询时,始终给出错误 CreateRecordset error 80041605 The query contained only ignored words
(英文查询时正常)请大侠们拔刀相助!
源码如下:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
<html>

<head><%
' ********** INSTRUCTIONS FOR QUICK CUSTOMIZATION **********
'
' This form is set up for easy customization. It allows you to modify the
' page logo, the page background, the page title and simple query
' parameters by modifying a few files and form variables. The procedures
' to do this are explained below.
'
'
' *** Modifying the Form Logo:

' The logo for the form is named is2logo.gif. To change the page logo, simply
' name your logo is2logo.gif and place in the same directory as this form. If
' your logo is not a GIF file, or you don't want to copy it, change the following
' line so that the logo variable contains the URL to your logo.

FormLogo = "is2logo.gif"

'
' *** Modifying the Form's background pattern.

' You can use either a background pattern or a background color for your
' form. If you want to use a background pattern, store the file with the name
' is2bkgnd.gif in the same directory as this file and remove the remark character
' the single quote character) from the line below. Then put the remark character on
' the second line below.
'
' If you want to use a different background color than white, simply edit the
' bgcolor line below, replacing white with your color choice.

' FormBG = "background = " & chr(34) & "is2bkgnd.gif" & chr(34)
FormBG = "bgcolor = " & chr(34) & "#FFFFFF" & chr(34)


' *** Modifying the Form's Title Text.

' The Form's title text is set on the following line.
%>

<title>茶网站搜索</title>
<%
'
' *** Modifying the Form's Search Scope.
'
' The form will search from the root of your web server's namespace and below
' (deep from "/" ). To search a subset of your server, for example, maybe just
' a PressReleases directory, modify the scope variable below to list the virtual path to
' search. The search will start at the directory you specify and include all sub-
' directories.

FormScope = "/"

'
' *** Modifying the Number of Returned Query Results.
'
' You can set the number of query results returned on a single page
' using the variable below.

PageSize = 10

'
' *** Setting the Locale.
'
' The following line sets the locale used for queries. In most cases, this
' should match the locale of the server. You can set the locale below.

'SiteLocale=Request.QueryString("HTTP_ACCEPT_LANGUAGE")
SiteLocale = "EN-US"



' ********** END QUICK CUSTOMIZATION SECTIONS ***********
%>
<meta NAME="DESCRIPTION" CONTENT="茶文化网站">
<meta NAME="AUTHOR" CONTENT="Index Server Team">
<meta NAME="KEYWORDS" CONTENT="query, content, hit">
<meta NAME="SUBJECT" CONTENT="查询单">
<meta NAME="scth" CONTENT="Internet">
<meta NAME="scth.LOCALE" CONTENT="EN-US">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<%
' Set Initial Conditions
NewQuery = FALSE
UseSavedQuery = FALSE
SearchString = ""

QueryForm = Request.ServerVariables("PATH_INFO")

' Did the user press a SUBMIT button to execute the form? If so get the form variables.
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
SearchString = Request.Form("SearchString")
'FreeText = Request.Form("FreeText")
' NOTE: this will be true only if the button is actually pushed.
if Request.Form("Action") = "Go" then
NewQuery = TRUE
end if
end if
if Request.ServerVariables("REQUEST_METHOD") = "GET" then
SearchString = Request.QueryString("qu")
'FreeText = Request.QueryString("FreeText")
FormScope = Request.QueryString("sc")
if Request.QueryString("pg") <> "" then
NextPageNumber = Request.QueryString("pg")
NewQuery = FALSE
UseSavedQuery = TRUE
else
NewQuery = SearchString <> ""
end if
end if
%>
</head>

<body <%=FormBG%>>

<form ACTION="<%=QueryForm%>" METHOD="POST">
<center>
<table WIDTH="50">
<tr>
<td nowrap>搜索:<input TYPE="TEXT" NAME="SearchString" SIZE="20" MAXLENGTH="100"
VALUE="<%=SearchString%>"></td>
<td align="left"><input TYPE="SUBMIT" NAME="Action" VALUE="Go"></td>
</tr>
</table>
</center>
</form>

<p><%
if NewQuery then
set Session("Query") = nothing
set Session("Recordset") = nothing
NextRecordNumber = 1

' Remove any leading and ending quotes from SearchString

SrchStrLen = len(SearchString)

if left(SearchString, 1) = chr(34) then
SrchStrLen = SrchStrLen-1
SearchString = right(SearchString, SrchStrLen)
end if

if right(SearchString, 1) = chr(34) then
SrchStrLen = SrchStrLen-1
SearchString = left(SearchString, SrchStrLen)
end if

if FreeText = "on" then
CompSearch = "$contents " & chr(34) & SearchString & chr(34)
else
CompSearch = SearchString
end if

set Q = Server.CreateObject("ixsso.Query")
'Q.AllowEnumeration = TRUE
set util = Server.CreateObject("ixsso.Util")

Q.Query = CompSearch
Q.SortBy = "rank[d]"
Q.Columns = "DocTitle, vpath, filename, size, write, characterization"

if FormScope <> "/" then
util.AddScopeToQuery Q, FormScope, "deep"
end if

if SiteLocale<>"" then
Q.LocaleID = util.ISOToLocaleID(SiteLocale)
end if

set RS = Q.CreateRecordSet("nonsequential")

RS.PageSize = PageSize
ActiveQuery = TRUE

elseif UseSavedQuery then
if IsObject( Session("Query") ) And IsObject( Session("RecordSet") ) then
set Q = Session("Query")
set RS = Session("RecordSet")

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

if ActiveQuery then
if not RS.EOF then
%> </p>

<hr WIDTH="100%" ALIGN="center" SIZE="1" color="#FF00FF">

<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 "本页显示的是第 " & NextRecordNumber & " 到第 " & LastRecordOnPage & "条记录,"
if RS.RecordCount <> -1 then
Response.Write " 一共找到 " & RS.RecordCount
end if
Response.Write " 条相匹配的 " & chr(34) & "<I>"
Response.Write SearchString & "</I>" & chr(34) & "记录。<P>"
%>

<dl>
<% 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 filename.
%>
<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="<%=RS("vpath")%>">http://<%=Request("server_name")%><%=RS("vpath")%></a>
<font size=-1> - <%if RS("size") = "" then%>(size and time unknown)<%else%>size <%=RS("size")%> bytes - <%=RS("write")%> GMT<%end if%></font>
</cite>

<%if SearchString <> "" then%>
<BR>
<%
' Construct the URL for hit highlighting

WebHitsQuery = "CiWebHitsFile=" & Server.URLEncode( RS("vpath") )
WebHitsQuery = WebHitsQuery & "&CiRestriction=" & Server.URLEncode( Q.Query )
WebHitsQuery = WebHitsQuery & "&CiBeginHilite=" & Server.URLEncode( "<font color=""#FF0000""><b><em>" )
WebHitsQuery = WebHitsQuery & "&CiEndHilite=" & Server.URLEncode( "</em></b></font>" )
WebHitsQuery = WebHitsQuery & "&CiUserParam3=" & QueryForm
' WebHitsQuery = WebHitsQuery & "&CiLocale=" & Q.LocaleID
%>
<BR>
<%end if%>

<%
RS.MoveNext
NextRecordNumber = NextRecordNumber+1
Loop
%>
<p><br>
<%
'else ' NOT RS.EOF
if NextRecordNumber = 1 then
Response.Write "没有找到您要的关键词文件!<P>"
else
Response.Write "以上是搜索得到的结果!<P>"
end if

end if ' NOT RS.EOF


if NOT Q.OutOfDate then
' If the index is current, display the fact %></p>

<p><i><b>The index is up to date.</b></i><br>
<%end if


if Q.QueryIncomplete then
' 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 %></p>

<p><i><b>The query is too expensive to complete.</b></i><br>
<%end if


if Q.QueryTimedOut then
' If the query took too long to execute (for example, if too much work
' was required to resolve the query), let the user know %></p>

<p><i><b>The query took too long to complete.</b></i><br>
<%end if%></p>

<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 %>
<tr>
<td align="left"><form action="<%=QueryForm%>" method="get">
<input type="hidden" name="qu" value="<%=SearchString%>"><input type="hidden"
name="FreeText" value="<%=FreeText%>"><input type="hidden" name="sc"
value="<%=FormScope%>"><input type="hidden" name="pg" value="<%=CurrentPage-1%>"><p><input
type="submit" value="前<%=RS.PageSize%>个文件"> </p>
</form>
</td>
<%SaveQuery = TRUE%>
<%end if%>
<%
' This is the "next" button for unsorted queries.
' This retrieves the next page of documents for the query.

if Not RS.EOF then%>
<td align="right"><form action="<%=QueryForm%>" method="get">
<input type="hidden" name="qu" value="<%=SearchString%>"><input type="hidden"
name="FreeText" value="<%=FreeText%>"><input type="hidden" name="sc"
value="<%=FormScope%>"><input type="hidden" name="pg" value="<%=CurrentPage+1%>"><% NextString = "下 "
if RS.RecordCount <> -1 then
NextSet = (RS.RecordCount - NextRecordNumber) + 1
if NextSet > RS.PageSize then
NextSet = RS.PageSize
end if
NextString = NextString & NextSet & "个文件"
else
NextString = NextString & " page of documents"
end if
%>
<p><input
type="submit" value="<%=NextString%>"> </p>
</form>
</td>
<%SaveQuery = TRUE%>
<%end if%>
</tr>
</table>
<% ' Display the page number %>

<p>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 %> <!--#include file ="is2foot.inc"--> </p>
</body>
</html>
...全文
177 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
王释之 2000-05-20
  • 打赏
  • 举报
回复
太长了,如果用'get'方式提交,中文一般是不行的.
eaglet 2000-05-19
  • 打赏
  • 举报
回复
把你出现错误的那条SQL语句
用response.write显示出来
给我看看
iis6.0完整安装包xp+iis 6.0 完整安装包 xp sp3 IIS 6.0 的一个最重要的变动涉及 Web 服务器安全性。为了更好地预防恶意用户和攻击者的攻击,在默认情况下,没有将 IIS 安装在 Microsoft Windows Server 2003 家族的成员上。 要点 为了更好地预防恶意用户和攻击者的攻击,没有将 IIS 默认安装到 Microsoft® Windows® Server 2003 家族的成员上。而且,当您最初安装 IIS 时,该服务在高度安全和“锁定”的模式下安装。在默认情况下,IIS 只为静态内容提供服务 - 即,ASP、ASP.NET、服务器端包含、WebDAV 发布和 FrontPage® Server Extensions 等功能只有在启用时才工作。如果安装 IIS 之后未启用该功能,则 IIS 返回一个 404 错误。您可以为动态内容提供服务,并通过 IIS 管理器的 Web 服务扩展节点启用这些功能。同样,如果应用程序扩展未在 IIS 进行映射,则 IIS 返回一个 404 错误。要映射扩展,请参阅设置应用程序映射。有关如何排解 404 错误(包括 404.2 和 404.3)、与 IIS 6.0 的新安装相关的问题或从低版本的 IIS 进行升级的详细信息,请参阅疑难解答。 iis6.0完整安装包xp 通过 Web 服务器证书向导和 CTL 向导,您可以同步 Web 和 NTFS 的安全设置、获得并安装服务器证书以及创建和修改证书信任列表。还可以选择一个加密服务提供程序 (CSP) 以使用证书加密数据。 详细信息,请参阅使用证书向导。

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧