大虾,帮帮在下!在线等!

swshan 2004-05-06 02:22:28
我在测试是否与数据库连接上。
这是我的连接文件:
<%
Function openDB()
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
ConnString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=olbs;Data Source=sw;PWD=123"
conn.Open ConnString
end function
Function closeDB()
set rs=nothing
conn.close
set conn=nothing
end function
%>
以下是我的二个测试文件:
************************
test.asp
<body>
<form action="test.asp" method="post">
<p><input type="text" name="sw"></p>
<p><input type="submit" value="提交"></p>
</form>
</body>
************************************************
test1.asp
<!--#include file="includes/dbconn.inc"-->
<%
sw=request.Form("sw")
%>
<%=sw%>
<%
call openDB()
sql="select bookname form books where idbook="&sw
set rs=conn.execute(sql)
call closeDB()
%>
**********************************************
错误信息:
Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/iisHelp/common/500-100.asp,行242

Microsoft VBScript 运行时错误 错误 '800a01a8'

缺少对象: ''

/shanwu/design/TMPd76zxxa44z.asp,行9

...全文
121 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
swshan 2004-05-06
  • 打赏
  • 举报
回复
我的是数据值型的,那样我试过了,不行的。对了,test.asp中的action="test1.asp"不好意思打错了。
sfply 2004-05-06
  • 打赏
  • 举报
回复
楼上的,别人的可能是数值型,SQL并没错
from 错了没?
我估计问题出在用过程方式打开数据连接的问题
upload 2004-05-06
  • 打赏
  • 举报
回复
说你缺少End你就去查下啊,sql="select bookname from books where idbook='"&sw&"'"
whghwujx 2004-05-06
  • 打赏
  • 举报
回复
sql="select bookname from books where idbook='"&sw&"'"

楼主注意单引号了
liuyangxuan 2004-05-06
  • 打赏
  • 举报
回复
sql="select bookname form books where idbook='"&sw&"'"

28,409

社区成员

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

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