根据文本框内输入的内容,搜索数据库中包含该内容的信息,然后显示
lqsmj 2008-03-12 04:19:05 根据文本框内输入的内容,搜索数据库中包含该内容的信息,然后显示.我的代码如下,但测试未通过,错误信息:行15,缺少";" 就是这行:<input type="text" name="textfield" onKeyUp="Call abc(this.value)">请高手指教...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/SMJDSN.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<form name="form1" method="post" action="" >
<input type="text" name="textfield" onKeyUp="Call abc(this.value)">
</form>
<% Function abc(x)%>
<%Dim R1
Dim R1_numRows
Set R1 = Server.CreateObject("ADODB.Recordset")
R1.ActiveConnection = MM_SMJDSN_STRING
R1.Source = "SELECT 抬头 FROM 开票资料 WHERE 抬头 LIKE '%" + Replace(x, "'", "''") + "%'"
R1.CursorType = 0
R1.CursorLocation = 2
R1.LockType = 1
R1.Open()
R1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
R1_numRows = R1_numRows + Repeat1__numRows
%>
<% If Not R1.EOF Or Not R1.BOF Then %>
<table width="232" height="129" border="1">
<tr>
<td><%
While ((Repeat1__numRows <> 0) AND (NOT R1.EOF))
%>
<%=(R1.Fields.Item("抬头").Value)%><br>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
R1.MoveNext()
Wend
%></td>
</tr>
</table>
<% End If ' end Not R1.EOF Or NOT R1.BOF %>
<%
R1.Close()
Set R1 = Nothing
%>
<%end Function%>
</body>
</html>