标题:请问这段代码哪错了,运行说无法显示网页,
取消只看楼主
piratesky
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-7-15
结帖率:0
 问题点数:0 回复次数:3 
请问这段代码哪错了,运行说无法显示网页,
CODE:
<!--#include file="conn.asp"-->
<%
exec="select * from aa order by id desc "
set rs=server.create
rs.open exec,conn,1,1
%>
<%
if rs.eof and rs.bof then
response.write("暂时没有文章")
else
do while not rs.eof
%>
 
 <%=rs("id")%>
 <%=rs("name")%>
 <%=rs("content")%>
 <%=rs("xhtime")%>
 <%=rs("title")%>
 " target="_self">编辑
 ">删除
 
<%
rs.movenext
loop
end if
%>
 
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
搜索更多相关主题的帖子: 网页 编辑 target 
2011-07-15 17:20
piratesky
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-7-15
得分:0 
我是从别人的帐子里拷过来的,就是运行不了, 我把全部考给你看
2011-07-15 22:13
piratesky
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-7-15
得分:0 
index.asp
<!--#include file="conn.asp"-->
<%
exec="select * from aa order by id desc "
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<table width="628" height="24" border="1" align="center" cellpadding="1" cellspacing="0">
<%
if rs.eof and rs.bof then
response.write("暂时没有文章")
else
do while not rs.eof
%>
<tr>
<td width="66" height="22" ><%=rs("id")%></td>
<td width="66" ><%=rs("name")%></td>
<td width="66" ><%=rs("content")%></td>
<td width="273" ><%=rs("xhtime")%></td>
<td width="53" ><%=rs("title")%></td>
<td><a href="modify.asp?id=<%=rs("id")%>" target="_self">编辑</a></td>
<td width="32" ><a href="del.asp?id=<%=rs("id")%>">删除</a></td>
</tr>
<%
rs.movenext
loop
end if
%>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<td><a href="add.asp">添加</a></td>

conn.asp
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&amp;server.mappath("xhnew.mdb")
%>

add.asp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<form name="form1" method="post" action="add_new.asp">
名字 <input type="text" name="name"><br>
备注 <input type="text" name="content"><br>
题目<input type="text" name="title" ><br>
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</form>
</body>
</html>
2011-07-15 22:17
piratesky
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-7-15
得分:0 
add_new.asp
<!--#include file="conn.asp"-->

<%
name=request.form("name")
content=request.form("content")
title=request.form("title")
exec="insert into aa(name,content,title) values('"+name+"','"+content+"','"+title+"')"
conn.execute exec
conn.close
set conn=nothing
response.redirect "index.asp"
%>

del.asp
<!--#include file="conn.asp"-->
<%
exec="delete * from aa where id="&amp;request.querystring("id")
conn.execute exec
conn.close
set conn=nothing
response.redirect "index.asp"
%>

modify.asp
<!--#include file="conn.asp"-->
<%
exec="select * from aa where id="&amp;request.querystring("id")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<form name="form1" method="post" action="modifysave.asp">
<table width="748" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>name</td>
    <td>content</td>
    <td>title</td>
  </tr>
  <tr>
    <td>
    <input type="text" name="name" value="<%=rs("name")%>">
    </td>
    <td>
    <input type="text" name="content" value="<%=rs("content")%>">
    </td>
    <td><input type="text" name="title" value="<%=rs("title")%>">
    <input type="submit" name="Submit" value="提交">
    <input type="hidden" name="id" value="<%=request.querystring("id")%>">
    </td>
  </tr>
</table>
</form>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>


modifysave.asp
<!--#include file="conn.asp"-->
<%
exec="select * from aa where id="&amp;request.form("id")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
%>
<%

rs("name")=request.form("name")
rs("content")=request.form("content")
rs("title")=request.form("title")
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.redirect"index.asp"
%>
2011-07-15 22:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-345587-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.065541 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved