问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

如何用Asp+Access制作简单的新闻发布

发布网友 发布时间:2023-11-09 00:37

我来回答

4个回答

热心网友 时间:2023-11-28 02:44

谁能解决我的问题
http://zhidao.baidu.com/question/39689782.html

悬赏200还可以追加!高手速来!

热心网友 时间:2023-11-28 02:45

数据库连接文件(myconn.asp):
<%
dim conn '数据库连接
dim connstr '连接字符串
dim db '数据库文件路径
db = "qqchen.mdb"
connstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db)
Set conn = Server.CreateObject("ADODB.Connection")
If Err Then
Err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请打开conn.asp文件检查连接字串。"
Response.End
End If
conn.Open connstr
%>

'************************************************************
显示文章列表(articlelist.asp):
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="myconn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>显示文章列表</title>
</head>
<body>
<div align="center">
<div align=left>◆<a href="addarticle.asp">发布新文章</a></div>
<table width="100%" border="0" cellspacing="1" bgcolor="#000000">
<tr>
<td width="7%" height="25" align="center" bgcolor="#FFFFFF"><strong>编号</strong></td>
<td width="51%" height="25" align="center" bgcolor="#FFFFFF"><strong>标题</strong></td>
<td width="20%" height="25" align="center" bgcolor="#FFFFFF"><strong>Nclassid</strong></td>
<td width="22%" height="25" align="center" bgcolor="#FFFFFF"><strong>操作</strong></td>
<%
Set Rs=conn.Execute("Select * From article Order By articleid")
If Not Rs.Eof Then
Do While Not Rs.Eof
%>
<tr>
<td align="center" bgcolor="#FFFFFF"><%=Rs("articleid")%></td>
<td align="center" bgcolor="#FFFFFF"><a href="showarticle.asp?articleid=<%=Rs("articleid")%>"><%=Rs("title")%></a></td>
<td align="center" bgcolor="#FFFFFF"><%=Rs("nclassid")%></td>
<td align="center" bgcolor="#FFFFFF"><a href="modifyarticle.asp?articleid=<%=Rs("articleid")%>">修改</a> | <a href="deletearticle.asp?articleid=<%=Rs("articleid")%>">删除</a></td>
</tr>
<%
Rs.Movenext
Loop
Else
%>
<tr>
<td colsapn=4 align="center" bgcolor="#FFFFFF"></td>
</tr>
<%End If%>
</table>
</div>
</body>

'************************************************************
显示文章信息(showarticle.asp):
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="myconn.asp"-->
<%
articleid=Cint(Request("articleid"))
If articleid>0 Then
Set Rs=conn.Execute("Select * From article Where articleid="&articleid)
conn.Execute("Update article Set hits=hits+1 Where articleid="&articleid)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>阅读记录:<%=Rs("title")%></title>
</head>

<body>
<div align="center">
<table width="70%" border="1" cellpadding="4" cellspacing="0">
<tr>
<td width="19%" align="right">编号:</td>
<td width="81%" align="left"><%=Rs("articleid")%></td>
</tr>
<tr>
<td align="right">标题:</td>
<td align="left"><%=Rs("title")%></td>
</tr>
<tr>
<td align="right">nclassid:</td>
<td align="left"><%=Rs("nclassid")%></td>
</tr>
<tr>
<td align="right">classid:</td>
<td align="left"><%=Rs("classid")%></td>
</tr>
<tr>
<td align="right">浏览次数:</td>
<td align="left"><%=Rs("hits")%> 次</td>
</tr>
<tr>
<td align="right" valign="top">内容:</td>
<td align="left"><%=Rs("content")%></td>
</tr>
</table>
</div>
</body>
</html>
<%
Else
Response.Write "该文章不存在"
End If
%>

'************************************************************
添加文章信息(addarticle.asp):
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="myconn.asp"-->
<%
If Request.ServerVariables("REQUEST_METHOD")="POST" Then
content=Replace(Replace(Request("content")," "," "),chr(13),"<br>")
conn.Execute("Insert Into article(title,content,nclassid,classid) values('"&Request("title")&"','"& content &"',"&Request("nclassid")&","&Request("classid")&")")
Response.Redirect "articlelist.asp"
Else
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="?">
<table width="60%" border="1" cellpadding="4" cellspacing="0">
<tr>
<td align="right">标题:</td>
<td align="left"><input name="title" type="text" id="title"></td>
</tr>
<tr>
<td align="right">nclassid:</td>
<td align="left"><input name="nclassid" type="text" id="nclassid"" /></td>
</tr>
<tr>
<td align="right">classid:</td>
<td align="left"><input name="classid" type="text" id="classid"></td>
</tr>
<tr>
<td align="right">内容:</td>
<td align="left"><textarea name="content" cols="45" rows="10" id="content"></textarea></td>
</tr>
<tr>
<td align="right"> </td>
<td align="left"><input type="submit" name="Submit" value="修改" />
<input type="reset" name="Submit2" value="重置" />
<input type="button" name="Submit3" value="返回" onclick="history.back()"></td>
</tr>
</table>
</form>
</body>
</html>
<%End If%>

'************************************************************
修改文章信息(modifyarticle.asp):
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="myconn.asp"-->
<%
articleid=Cint(Request("articleid"))
If Request.ServerVariables("REQUEST_METHOD")="POST" Then

If articleid>0 Then
content=Replace(Replace(Request("content")," "," "),chr(13),"<br>")
conn.Execute("Update article Set title='"&Request("title")&"',content='"&content&"',nclassid="&Request("nclassid")&",classid="&Request("classid")&" Where articleid="&articleid)
Response.Redirect "articlelist.asp"
Else
Response.Write "该文章不存在"
End If
Else
If articleid>0 Then
Set Rs=conn.Execute("Select * From article Where articleid="&articleid)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<div align="center">
<form id="form1" name="form1" method="post" action="?articleid=<%=articleid%>">
<table width="60%" border="1" cellpadding="4" cellspacing="0">
<tr>
<td width="22%" align="right">编号:</td>
<td width="78%" align="left"><%=Rs("articleid")%></td>
</tr>
<tr>
<td align="right">标题:</td>
<td align="left"><input name="title" type="text" id="title" value="<%=Rs("title")%>" /></td>
</tr>
<tr>
<td align="right">nclassid:</td>
<td align="left"><input name="nclassid" type="text" id="nclassid" value="<%=Rs("nclassid")%>" /></td>
</tr>
<tr>
<td align="right">classid:</td>
<td align="left"><input name="classid" type="text" id="classid" value="<%=Rs("classid")%>" /></td>
</tr>
<tr>
<td align="right">内容:</td>
<td align="left"><textarea name="content" cols="45" rows="10" id="content"><%=Replace(Replace(Rs("content"),"<br>",chr(13))," "," ")%></textarea></td>
</tr>
<tr>
<td align="right"> </td>
<td align="left"><input type="submit" name="Submit" value="修改" />
<input type="reset" name="Submit2" value="重置" />
<input type="button" name="Submit3" value="返回" onclick="history.back()"></td>
</tr>
</table>
</form>
</div>
</body>
</html>
<%
Else
Response.Write "该文章不存在"
End If
End If
%>

'************************************************************
删除文章信息(deletearticle.asp):
<!--#include file="myconn.asp"-->
<%
articleid=Cint(Request("articleid"))
If articleid>0 Then
conn.Execute("Delete From article Where articleid="&articleid)
Response.Write "删除成功,<a href='articlelist.asp'>返回</a>"
Else
Response.Write "删除失败"
End If
%>

热心网友 时间:2023-11-28 02:46

当时他们什么也没说

热心网友 时间:2023-11-28 02:46

下载一个得了
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
...另有一盒质量不足,轻一些。至少称几次能保证找出这盒月饼... 9盒月饼中,有一盒质量不足,至少称()次能保证找出这盒月饼 A,2 B,3... 有244盒饼干其中有一盒饼干质量不足这一核轻一些至少称几次才能保证找出... 怎么处理梭子蟹更干净? 有什么学生去西藏穷游的打卡线路分享? 小米13手机系统导航方式哪种好用 哪些公交路线可以到犀浦车管所? 19世纪末,中国面临深重的民族危机。为了挽 救民族危亡,中国人民进行... 为什么我一听伤心的歌情绪很低落。听快节奏的歌就想跳。可是室友们没... 为什么我总是听着伤心的歌就低落 ...这样一条界线,向东过此线日期减一天,向西过此日期加一天,该界线大致... 我的电脑英特尔核心显示卡,我按了退出系统托盘,怎么才能再显示... 将一个5Ω的电阻和一个20Ω的电阻串联,等效电阻是_____...1 氯化银溶解于氨水化学式 一道地理时差题目 刚买的大米上有红线还有黄的有的还有黑色的这样的米可以吃吗6 如何批量清除WPS&#47;Word文档中的回车符?求教3 为什么有的大米一端有黄点?17 新买的大米受潮变黄还能吃吗?怎么处理?1 wps2019如何批量删除自动换行符?3 怎么批量清除WPS&#47;Word中的回车符?14 我家大米里怎么有发黄的大米,还能吃吗?28 中盐化工股行情走势?对中盐化工股票近期技术分析?2021年中... wps中表格如何批量删除内容下方的回车符?3 中盐化工股走势?中盐化工股票k线技术分析?股票中盐化工发行价... 中盐化工股最新股价与走势?中盐化工股份股票分析?股票中盐化工... 新浪微博我们学校名字被注册过了,但是我们学校官方想注册认证一...1 中盐化工股走势走析?今天中盐化工股票分析?股票中盐化工今日股... ...在支付宝无法认证新账户 你曾实名过的账户有风险行为 这个怎么解决... 怎么强制修改第二次 泰国的柠檬叶是普通的柠檬叶子吗1 道路运输企业 质量信誉考核 aa多少分1 新出的东风标致5082.3L顶配和雪铁龙C52.3L对比,从外形,性能,内部配件... 18点的时候吃了很多东西猪蹄……到21点的拉肚子了,是不是晚上吃的都白... 大家好,请问我的支付宝有绑定银行卡,昨天都能转账充值,今天要...1 标致5082.3智享型和迈锐宝2.0豪华哪个好 我的支付宝曾被人转账,但是我已经改了支付宝密码,还有银行卡密... 什么食物含原花青素最多31 支付宝里绑定的银行卡为什么删除不了?删除的时候支付密码是不是...1 泰国菜在中国有发展前途吗?2 源于泰国使用柠檬叶香茅虾咖喱等制成的汤叫什么2 QQ书签我都收集了12部书签了怎么还不亮 葡萄籽中含有的花青素最多么?11 一个手机怎么登录两个 餐厅服务员该怎么写辞职书? 新华电脑学校能学到东西吗?毕业有出路吗? 如何将QQ书签应用到Opera浏览器中 山顶洞人与北京人同为中国古人类,两者相比山顶洞人在体貌特征上有... 葡萄籽是不是含原花青素最高的物质 为什么我收藏了12个网址还没点亮QQ书签?