大家帮忙看看,这个代码怎么会出现以下错误

wg9606 2003-09-10 04:28:42
代码部分:

<%
set conn=server.CreateObject ("adodb.connection")
conn.Open "driver={SQL Server};server=ADMINISTRATOR;UID=sa;PWD=sa;database=movieonline"
set rs=server.CreateObject ("ADODB.Recordset")
rs.open “Select * from movielist where name_movie="&request.Form("name_movie")&",conn,1,1
if rs.eof and rs.bof then ’如果数据指针同时指到记录集的头部和尾部,说明这时候记录集为空
response.write“对不起,暂时没有您要查找的片子” ’打印“没有可以显示的数据”
do until rs.EOF ’循环 直到记录集尾部为止
response.write rs(“name_movie”) ’显示一个行的一个字段
response.write rs(“mainactor”) ’同上
response.write rs(“mainaction”) ’同上
response.write “
” ’一个行打印完毕,换行
rs.MoveNext ’将数据指针移到下一个行
loop ’循环结束
%>





<html>
<head>
<title>search</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>

</body>
</html>



错误类型:
Microsoft VBScript 编译器错误 (0x800A0408)
/search.asp, 第 5 行, 第 8 列
rs.open “Select * from movielist where name_movie="&request.Form("name_movie")&",conn,1,1
-------^


浏览器类型:
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

页:
POST 80 bytes to /search.asp

POST 数据:
radiobutton=radiobutton&name_movie=%CE%D2%CA%C7%CB%AD&actor=&search=%B2%E9%D5%D2

时间:
2003年9月10日, 16:18:13
...全文
50 16 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaobird1 2003-09-12
  • 打赏
  • 举报
回复
请重新贴出改后的代码。
zjg791015 2003-09-11
  • 打赏
  • 举报
回复
请把使用了全角字符的换成半角;如果是要查找字符串,请在'"&request.Form("name_movie")&"'这里多加一个单引号。
somecom 2003-09-11
  • 打赏
  • 举报
回复
if rs.eof and rs.bof then
->>if not rs.eof then

rs.open “Select * from movielist where name_movie="&request.Form("name_movie")&",conn,1,1
->>rs.open "Select * from movielist where name_movie="&request.Form("name_movie"),conn,1,1
celerylhl 2003-09-11
  • 打赏
  • 举报
回复
rs.open “ '这里用了全角字符改为
rs.open "

wg9606 2003-09-11
  • 打赏
  • 举报
回复
是这个原因的吗?
wg9606 2003-09-11
  • 打赏
  • 举报
回复
大家帮帮忙好吗,很急的
wg9606 2003-09-11
  • 打赏
  • 举报
回复
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
/ok.asp, 第 5 行


那这个错误是为什么呢
KUMOZAKI 2003-09-10
  • 打赏
  • 举报
回复
错误的可能原因有:
do...loop的执行方法是您的条件until rs.eof达到时都会执行内面的程序,所以在rs到了eof后都会执行那三个response语句,所以我建议用while...wend
wg9606 2003-09-10
  • 打赏
  • 举报
回复
name_m=rs("name_movie")
actor=rs("mainactor")
action=rs("mainaction")

response.write name_m '显示一个行的一个字段
response.write mainactor '同上
response.write mainaction '同上

我把代码改成这样子了,可是还不可以

Microsoft VBScript 编译器错误 (0x800A03F6)
/search.asp, 第 18 行
youhj 2003-09-10
  • 打赏
  • 举报
回复
请参考 xiaobird1(想作千里马、还是伯乐) 和YeeDRain(魔鬼也会哭) 的
富察咪咪 2003-09-10
  • 打赏
  • 举报
回复
rs.open “ '这里好象是汉字
Select * from movielist where name_movie="&request.Form("name_movie")&",conn,1,1
wg9606 2003-09-10
  • 打赏
  • 举报
回复
response.write rs(“name_movie”) ’显示一个行的一个字段
response.write rs(“mainactor”) ’同上
response.write rs(“mainaction”) ’同上


这里是不是这样子写的呢
这三个字段是库里的列名
类型为varchar
xiaobird1 2003-09-10
  • 打赏
  • 举报
回复
“ --> "


如果name_movie是数值型
rs.open "Select * from movielist where name_movie="&request.Form("name_movie"),conn,1,1

如果name_movie是字符型
rs.open "Select * from movielist where name_movie='"&request.Form("name_movie")&"'",conn,1,1
xiaobird1 2003-09-10
  • 打赏
  • 举报
回复
如果name_movie是数值型
rs.open "Select * from movielist where name_movie="&request.Form("name_movie"),conn,1,1

如果name_movie是字符型
rs.open "Select * from movielist where name_movie='"&request.Form("name_movie")&"'",conn,1,1
YeeDRain 2003-09-10
  • 打赏
  • 举报
回复
name_movie字段是字符串类型吧
rs.open “Select * from movielist where name_movie='"&request.Form("name_movie")&"'",conn,1,1
pimple 2003-09-10
  • 打赏
  • 举报
回复
rs.open “Select * from movielist where name_movie='"&request.Form("name_movie")&"',conn,1,1

28,409

社区成员

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

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