看看我的数据库连接问题

yujimanpao 2006-05-05 06:58:38
ipfind.asp
内容如下
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>IP地址查询</title>
</head>

<body>
<form name="form1" method="post" action="index.asp">
搜索:<br>
姓名:
<input type="text" name="name">
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</form>

</table>

</body>
</html>


index.asp
内容如下

<%
name="%"
if request.form("name")<>"" then
name=request.form("name")
end if
ip="%"
if request.form("ip")<>"" then
ip=request.form("ip")
end if
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("ip.mdb")
exec="select * from ip where name='"&name&"' and ip='"&ip&"'"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>IP地址查询</title>
</head>

<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">IP地址查询</td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr align="center" >
<td>单位</td>
<td>姓名</td>
<td>IP地址</td>
<td>MAC地址</td>
</tr>
<%do while not rs.eof%>
<tr align="center">
<td><%=rs("unit")%></td>
<td><%=rs("name")%></td>
<td><%=rs("ip")%></td>
<td><%=rs("mac")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>

</body>
</html>

说我第14行错误 为什么/.?//
...全文
162 3 打赏 收藏 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yujimanpao 2006-05-05
  • 打赏
  • 举报
回复
rs.open exec,conn,1,1
就是这一行有错误
我也没设置变量的类型啊
basanovic 2006-05-05
  • 打赏
  • 举报
回复
可能是变量类型有问题,看看IP变量什么类型,类型不对,没法查询数据库,就可能报rs.open exec,conn,1,1 错
mhxz5680 2006-05-05
  • 打赏
  • 举报
回复
14行是哪行啊?

出错信息又是什么,怎么不贴啊?

28,402

社区成员

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

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