rs_ccong.close
set rs_ccong=nothing
%>
<form name="CcongForm" action="save.asp" method="post">
<input type="text" name="CcongContent" value="<%=CcongContent%>" size="20">
<input type="hidden" name="Id" value="<%=CcongId%>">
<input type="submit" name="submit" value="确定">
</form>
(6)save.asp
<!--#include file="conn.asp"-->
<%
CcongId=request.form("id")
if CcongId="" then
response.write "非法进入"
response.end '强制结束
end if
CcongContent=trim(request.form("CcongContent")) '注意区别del.asp
if CcongContent="" then
response.write "内容为空"
response.end '强制结束
end if
dim CconGsave '自定义CconGsave
CconGsave="update CcongData set CcongContent='" & CcongContent & "' where CcongId=" &CcongId
conn.Execute(CconGsave)
response.Redirect("show.asp")
%>
(7)conn.asp
<%
On Error Resume Next '忽略错误,做高手一定要使用此句,防止程序发生错误时,黑客偷窥重要信息,调试程序时候,建议关闭
db="#ccong .mdb" '连接数据库加#加空格,保护数据库非法下载
Set conn= Server.CreateObject("ADODB.Connection")
'cConGdb="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
'如果你的服务器使用老版本的ACCESS驱动,请使用以下方法打开数据库
cConGdb="DBQ="&Server.Mappath(""&db&"")&";DRIVER={Microsoft Access Driver (*.mdb)};"
conn.Open cConGdb '打开数据库
%>
备注:打开show.asp,点击“ID”就删除信息,点击“内容”就编辑信息。本程序匆匆已经测试没有任何BUG。注意,匆匆第一次写教程,难免有一些疏忽和手法老套,如果你有什么意见或者疑问请直接联系:QQ19807980 19807980@QQ.COM 匆匆都会为你解答。
本程序每一句话都会让你不断成长,基本上没有任何垃圾代码,并且程序使用语法都是一些常用的语法,只要你彻底消化了本程序,相信目前流行的:日记本,留言本程序啊,你也可以轻松写出。
| 对此文章发表了评论 |
