超级菜鸟问题,白拿分!!!

silvercard 2005-05-16 12:29:46
<%
name=request.form("name")
tel=request.form("tel")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("example3.mdb")
exec="select * from guestbook where name='"+name+"' and tel="+tel
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1 <<<<----------这里是行8
%>
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
do while not rs.eof
%><tr>
<td><%=rs("name")%></td>
<td><%=rs("tel")%></td>
<td><%=rs("message")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>
</body>
</html>
--------------------------
数据库的名字是example3.mdb.里边的表叫guestbook
里边有3列,分别是name(文本),tel(数字),message(备注)
--------------------------
这是错误

Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

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

Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

ODBC 驅動程式不支援此要求內容。

/silvercard/pra/example6.asp,行8


我想各位前辈一定一眼就能看出来问题.可是我不知道是哪里的问题.个人认为是 tel="+tel 这里的问题.应该怎样改呢?
本人是个新手,另外又比较菜.问题很白痴,希望能指点一下,谢谢
...全文
105 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
baikaishui_0825 2005-05-16
  • 打赏
  • 举报
回复
response.write(exec)
在第八行之前加这一句,看看你的sql语句
hxyman 2005-05-16
  • 打赏
  • 举报
回复
exec="select * from guestbook where name='"&name&"' and tel='"&tel&"'"
FlashK 2005-05-16
  • 打赏
  • 举报
回复
exec="select * from guestbook where name='" & name & "' and tel='" & tel & "'"
silvercard 2005-05-16
  • 打赏
  • 举报
回复
谢谢大家~~结贴喽~~`
baikaishui_0825 2005-05-16
  • 打赏
  • 举报
回复
<%if not rs.eof then
do while not rs.eof
%><tr>
<td><%=rs("name")%></td>
<td><%=rs("tel")%></td>
<td><%=rs("message")%></td>
</tr>
<%
rs.movenext
loop
else%>
<tr><td>没有记录</td></tr>
<%end if
%>
silvercard 2005-05-16
  • 打赏
  • 举报
回复
还想请教一个问题呀.

如果没有找到用户输入的数据,那么 错误提示 应该在什么地方写呢?谢谢各位了!
spirit729 2005-05-16
  • 打赏
  • 举报
回复
exec="select * from guestbook where name='" & name & "' and tel='" & tel & "'"

exec="select * from guestbook where name='"&name&"' and tel='"&tel&"'"


正解
iamgsyy 2005-05-16
  • 打赏
  • 举报
回复
exec="select * from guestbook where name='" & name & "' and tel='" & tel & "'"

exec="select * from guestbook where name='"&name&"' and tel='"&tel&"'"

都正确
silvercard 2005-05-16
  • 打赏
  • 举报
回复
谢了,各位.问题解决了~~~

不过,各位对于这种编程.在数据传递过程中,是否遇到 得到的数据多了一个空格呢?
这样的问题是怎么产生的?就是因为多了一个空格,我才看了好久,加了一个trim就好了.

28,406

社区成员

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

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