根据文本框内输入的内容,搜索数据库中包含该内容的信息,然后显示

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>

...全文
327 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jadeluo 2008-03-16
  • 打赏
  • 举报
回复
Function abc(x)是在客户端运行的, 能实现"根据文本框内输入的内容,搜索数据库中包含该内容的信息"的功能吗?
杨哥儿 2008-03-16
  • 打赏
  • 举报
回复
onKeyUp="abc(this.value)"

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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