这个ASP程序错在哪里啊?请帮忙啊.

来源:百度知道 编辑:UC知道 时间:2024/05/26 05:02:00
<%@language=vbscript%>
<%response.buffer=true%>
<html>
<title>图书查询</title>
<head>
<script language="vbscript" runat="server">
sub rs_display()
dim strbookname
strbookname=request.form("bookname")
set conn=server.createobject("adodb.connection")
conn.open "tushuguanli","zjj","1234"
sql="select * from booknet where bookname like '% "& trim(strbookname)& " %'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn
with response
if rs.eof then
.write "没有查询到相关记录!"
else
.write"<table border=1 cellspace=0 cellpadding=5>"&_
"<tr height=12><td width=80><b>图书编号</b></td>"&_
"<td width=270><b>书名</b&

没数据库连接
set conn=server.createobject("adodb.connection")
conn.open "tushuguanli","zjj","1234"

应该把conn.open "tushuguanli","zjj","1234" 换成
conn.open "数据库连接"
例如(假设tushuguanli是数据库,zjj是帐号,1234是密码,数据库在本机):
conn.open "Provider = Sqloledb; User ID = zjj; Password = 1234; Initial Catalog = tushuguanli; Data Source = 127.0.0.1;"

那就是你数据库连接字符串没写对