asp+access开发实例(适合新手参考)
发这个贴,确实让本版的各位高手见笑了 ,上个月,在本版各位热心版友的帮助下我顺利地交了差,给单位法规科做的文档管理系统,基于asp的B/S结构
不知道叫系统会不会太过 ,真的小得很,叫系统是用来忽悠领导的
写这个东西,主要是为了新手对asp有个快速的参考
个人感觉,不会的话很难,会的可能不屑一顾,我用自己的理解水平去写这个实例,希望对新手有些帮助.
同时,有错略的,望请各位高手斧正.也算是对我自己理解层次的提升吧.
楼下开始补充
[ 本帖最后由 2002070344 于 2007-5-6 12:36 编辑 ]
1预备知识
静态网页与动态网页这个我也说不清楚,反正有交互的都叫动态网页.
什么叫交互?交互就是有来有往,网页能根据你提交的信息更新网页的信息
静态的话,只能原来设计内容怎样就怎样,要改动更新,只能重新修改服务器端的网页,然后上传到服务器,再显现出来
可以说动态就是一个双工,打电话,大家都能说话
静态只是一个单向的交流,从服务器端到客户端而已.反方向?你朝他嚷,很郁闷,他听不见
ps:后院就是一个动态的网页,他采用的是php技术
老生常谈---3P的抉择
做动态网页,主流的三项技术是jsp/php/asp,号称3p
3p我觉得优选的话,肯定是jsp最好,网上有很多3p的横向比较,jsp的效率是最优的
但是基于某些条件的限制,个人的选择还是多样的
jsp/php的优势在跨平台,jsp需要对java有些了解,php相对来说容易掌握些
我主要说说asp的优势,asp主要的优势1个是易掌握,第2个是得到微软操作系统很好的支持
反过来说,asp在其他操作系统是不支持的
不支持似乎说得太绝对,资料说要几经折腾尚未达到很好的支持,对于我们新手而言,就是不支持啦
而且,就开发/调试环境来说,asp是最贴近我们使用习惯(微软的操作系统)
只要在微软的操作系统下加装IIS组件就可以开始你的asp冒险之旅
略谈一下B/S和C/S
C/S是client/server(客户端/服务器),就是把数据库放在远程的服务器端,在客户机上安装相应的软件来访问服务器端
B/S就是Browser/server(浏览器/服务器),用浏览器来访问远程的服务器端
两种结构各有优势,各有应用,B/S相对来说流行些,因为不用加装其他软件,只须通过IE就可访问数据库,对客户端来说,操作维护性高些
安装IIS
安装IIS不是很复杂,只是很多同学装的操作系统不是原版的操作系统,而且美化版的操作系统,例如番茄花园/雨林木风...
这样,在加装其他组件上会有些小troblue,例如提示找不到某文件
这里,根据我的经验,建议大家用原版的操作系统安装IIS
提示缺少文件不一定是缺文件而且每个版本的文件放置路径不一样,电脑分辨不过来,你搜索下光盘就可以了
如果实在找不到,可以到网站下载IIS文件包
再找不到的话,就减少安装组件,只要够解析网页就可以了
安装组件参考如下附件1
ps:需要升级到asp.net的话,只要加装.net框架的安装包就行了
[ 本帖最后由 2002070344 于 2007-5-5 23:00 编辑 ] 谢谢分享!
可以的话,能把源代码一起发上来吗?...
另外
我觉得有些太基础性的东西不用细说,只要提下
真想了解的
就要善用搜索,把作者提供的关键字搜一下
:)
还有疑问的话,再发帖问.
安装IIS:
http://www.google.cn/search?complete=1&hl=zh-CN&newwindow=1&q=%E5%AE%89%E8%A3%85IIS&meta=
什么是B/S C/S
http://www.google.cn/search?complete=1&hl=zh-CN&inlang=zh-CN&newwindow=1&q=%E4%BB%80%E4%B9%88%E6%98%AFB%2FS+C%2FS&meta=lr%3Dlang_zh-CN
你的疑问:
http://www.google.cn/search?complete=1&hl=zh-CN&newwindow=1&q=%E4%BD%A0%E7%9A%84%E7%96%91%E9%97%AE&meta=
[ 本帖最后由 iptton 于 2007-5-5 20:00 编辑 ] 嗯,会结合源码来说实例的
谢谢你的建议,由于我也是新手,所以我觉得新手很多概念不是很清晰,导致很难铺开
我结合自己的理解水平来谈,可能比资料上写的要贴近些,同时也肤浅些
确实,太冗长看起来似乎比较累,我稍微提炼一下
2开发准备
准备是指用户需求分析,和决定用什么方式去实现它需求分析要做得很专业我就没这个基础
我只是做了两个文档
一个是用户的事务流程图
一个是数据库的字段表
后面做起来,确实觉得做些琐碎的工作很必要
一个是把需求定下来,费事大家扯皮
有些家伙以为这个工作量小,(我一个人做,用工余时间做)做得差不多又提些新要求
永远都做不完
另外一个好处是,时刻能自我检查,查漏补缺
特别是数据库的字段表多达30余个字段,没注释,很快就不知哪个打哪个
另外,作为交互式网页,我觉得主要就是insert/update/select/delete/modfiy等几个动作
我下面将这几个要点铺开来讲,其他页面都是在上面的基础上修改的
补充一下,我是用asp+access的来实现需求的
access相对其他数据库来说,多为人所诟病
主要是容量大于2G的话,数据库动弹不了或者查询效率很差
数据库容易被下载泄密
文章最后稍微提出几个补救漏洞方案作为参考
但是,我这个实例是内网使用,相对来说安全不是主要的 ,能交差是最重要的
[ 本帖最后由 2002070344 于 2007-5-6 12:36 编辑 ]
3登陆界面
由于用户要求,要有一个登陆界面,不想给其他科室的人修改或者查看内容,非指定用户不能通过登陆检查.指定的用户又分两种类型:
一种是管理者,可以查询修改数据库,主要为法规科工作人员填报资料用.
另一种是授权的浏览者,就是单位的局长,他可以看每个个案的进展,但是不能修改数据库.
主要是为了避免局长达人的误操作 ,这个不是我说的,追究责任找法规科
源码如下:
login.asp
关键部分就是表单,我用蓝色字体框出
作用就是让客户填form,里面有两个文本框,一个用户,一个密码
按下提交按钮就把表单的填写的内容提交给logincheck.asp页面处理
主要是检查是不是授权用户
提示一下新手,这些代码不用自己一字一行写的
可以用dreamweaver(下面简称dw)的插入功能插入,对代码稍做修改就行了
这里不是说dw是万能的,它只是个辅助工具,能减轻我们的工作量,但前提要读懂代码
另外,我觉得dw不用针对性去学,跟word一样,摸一下就懂用了,复杂些的功能随着使用就会慢慢上手或者暂时用不上
<BODY>
<TABLE class=header_back cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=header_line>
<TABLE cellSpacing=0 cellPadding=0 width=727 align=center border=0>
<TBODY>
<TR>
<TD width=250 height="40"> </TD>
<TD vAlign=bottom align=middle width=269> </TD>
<TD width=208><IMG height=1 alt=""
src="img/tr_px.gif"
width=1></TD></TR>
<TR>
<TD colSpan=3> </TD>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=725 align=center border=0>
<TBODY>
<TR>
<TD class=copyright width=725> </TD>
</TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=725 align=center border=0>
<TBODY>
<TR>
<TD class=main vAlign=top align=left width=700>
<DIV align=center><span class="STYLE7"><strong> <SPAN class=STYLE4>法规科文档管理系统</SPAN></strong><SPAN class=STYLE5></SPAN></span><SPAN class=zag><BR>
<IMG
height=103 alt=Company
src="img/company.gif" width=403
align=middle></SPAN><BR>
</DIV>
<DIV align=center><IMG height=1 alt=""
src="img/hr_px.gif"
width="100%"></DIV>
<DIV align=left>
<H4 class=title_4> </H4>
<table width="760" border="0">
<tr>
<td bordercolor="0"><h4 class=title_5>欢迎登录</h4>
<table width="100%" border="0" bgcolor="#FFFFFF">
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<form name="form1" method="post" action="logincheck.asp">
<table width="54%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="38%"><div align="right" class="fieldtitle">帐号</div></td>
<td width="62%"><input name="username" type="text" class="forms" id="username" size="20"></td>
</tr>
<tr>
<td><div align="right" class="fieldtitle">密码</div></td>
<td><input name="userpsw" type="password" class="forms" id="userpsw" size="21"></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="Submit" type="submit" class="form" value="登陆">
</div></td>
</tr>
</table>
</form></td>
</tr>
</table></td>
<td><span class="title_4"><img height=120 hspace=10
src="img/note_ball.gif" width=145
align=right vspace=10></span></td>
</tr>
</table>
</DIV></TD></TR></TBODY></TABLE>
<DIV align=center><BR><IMG height=1 alt=""
src="images/hr_px.gif"
width=725><BR>
<br>
法规科工作人员使用<br>
<br>
惠州环境信息中心制作<BR>
<BR>
</DIV>
</BODY>
logincheck.asp
这个页面主要是用javascript来判断是否授权用户
把login.asp页面传递过来的username/userpsw分别保存起来,以备和数据查询核对
语句和c差不多,应该能看懂吧
帐号/密码为空就提示"帐号为空/密码为空"
然后跳回login.asp重新等待输入
如果帐号/密码不为空就查询数据库
if not rs.eof then 说明指针不是指到最后,也就是数据库有这个数据
然后把session("d_u_user")=d_u_user,用户名保存到session,以备后面的操作界面检查用户是否登陆
这个是为了避免用户跳过login.asp登陆界面直接访问index.asp页面
也是说我们在IE直接输入index.asp路径,我们会检查用户是否登陆,没登陆的话,跳回login.asp页面要求用户登陆
同时,这里只检查是否有用户名存在,其实还是一个漏洞(题外话)
检查是否为授权用户以外,我们还要判断它的权限
我这里设置d_u_power字段为1的话,为管理员
d_u_power字段为0的话,为授权浏览者
<head>
<meta http-equiv="Content-Type" c>
<title>判定控制</title>
</head>
<%
dim d_u_user,d_u_pwd
d_u_user=request("username")
d_u_pwd=request("userpsw")
if d_u_user="" then
%>
<script language=javascript>
alert("帐号为空");
location.href="login.asp"
</script>
<% end if %>
<% if d_u_pwd="" then
%>
<script language=javascript>
alert("密码为空");
location.href="login.asp"
</script>
<% end if %>
<%set rs=server.createobject("adodb.recordset")
rs.open "select * from d_user where d_u_user='"&d_u_user&"'",conn,1,3
if not rs.eof then
if d_u_pwd=rs("d_u_pwd") then
session("d_u_user")=d_u_user
select case rs("d_u_power")
case 1
Response.write("<script>location.href('index.asp')</script>" )
case 0
Response.write("<script>location.href('indexforview.asp')</script>" )
end select
else
response.write ("<script>alert('用户密码错误');location.href('login.asp')</script>")
end if
end if
if rs.eof then
response.write ("<script>alert('用户帐号错误');location.href('login.asp')</script>")
end if
%>
<body>
</body>
session.asp页面
<%
if session("d_u_user")="" then
response.write"<script>alert('对不起,您还没有登录!');location='login.asp'</script>"
response.end
end if
%>
[ 本帖最后由 2002070344 于 2007-5-5 23:09 编辑 ] 见笑了,都是在各位帮助下完成的,有朋友约去beerbeer ,先溜,回来补上
4主页面--含select查询功能
整个设计的要求比较简单,主要就是填报新个案,然后管理员和授权浏览者可以根据"案件名称"或者"调查部门"进行模糊查询,
最后就是点"案件名称"相对应的条目可以看见该个案的进展,
实际就是填写到哪个阶段就显示到哪个阶段,没有填写的部分不显示出来
index.asp页面
<!--#include file="session.asp" -->就是调用session.asp对用户是否已经登陆进行检查
<!--#include file="inc/dbconn.asp" -->就是调用数据库连接配置文件,对连接数据库进行预处理
typeid是要查询的字段,可供选择
txtitle是文本框填入要查询的文字
d_file 是数据库的表名,储存了表单提交的所有数据
order by d_f_id desc的意思是查询出来的数据按照d_f_id字段的大小倒序排放,desc是倒序的意思
<%do while not rs.eof%>
'夹在这中间的内容,根据查询结果来显示
<%i=i+1
IF i>=MaxPerPage then exit do
rs.movenext
loop
%>
<%@ codepage ="936" %>
<!--#include file="session.asp" -->
<!--#include file="inc/dbconn.asp" -->
<link rel="stylesheet" type="text/css" href="style.css"><title>法规科文档管理系统</title><body bgcolor="#FFFFFF" marginheight=0 marginwidth=0 leftmargin=0>
<%
'查询到的所有的记录数
dim totalPut
'显示的当前页面数
dim CurrentPage
'共分多少页显示
dim TotalPages
'每页显示多少条记录
dim MaxPerPage
'初始设置为10,一页最多10条记录
MaxPerPage=10
'中间的循环变量
dim i,j
'判断如果没有输入页面数,则显示第1个页面
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
'定义的记录集对象
dim rs
'sql命令
dim sql
set rs=server.createobject("adodb.recordset")
'生成sql命令
typeid=request("typeid")
if typeid="" then
sql="Select * From d_file order by d_f_id desc"
else
sql="select * from d_file where "
sql=sql&cstr(typeid)&" like '%"&request("txtitle")&"%' "
sql=sql&" order by d_f_id desc"
end if
'生成记录集
rs.open sql,conn,1,1
'判断是否有记录
'如果有符合条件的记录,则将符合条件的记录总数值赋给变量totalPut
totalPut=rs.recordcount
'分页判断,如果当前页面数小于1,则更改为1
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
'如果当前页数为1,则调用过程showcontent、函数showpage显示
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"index.asp"
else
'如果当前页数为其他页,则使用书签bookmark来定位后调用过程showcontent、函数showpage显示
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"index.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"index.asp"
end if
end if
rs.close
set rs=nothing
'定义过程SubContent,显示搜索表单
sub showContent
%>
<center>
<TABLE border=0 cellPadding=3 cellSpacing=0 width="600" style="border-collapse: collapse" bordercolor="#111111">
<TBODY><h1 align="center"><img src="img/yemei.jpg"></h1>
<TR bgcolor="#ffffcc">
<TD align=left bgcolor="#FFFFFF">
<table width="117" height="39" border="0" align="right" cellpadding="0">
<tr>
<td width="113"><a href="INSERT.ASP"><img src="img/luru.gif" alt="录入信息" width="162" height="24" border="0"></a></td>
</tr>
</table>
<form name="search" method="post" action="index.asp">
<p align="left">
<img src="img/search.gif" width="28" height="22"> 支持模糊搜索:
<select style="font-size: 9pt" name="typeid">
<option value="d_f_ajmc">案件名称</option>
<option value="d_f_dcbm">调查部门</option>
</select>
<input type="text" name="txtitle" size="20" style="font-size: 9pt">
<INPUT align=absMiddle border=0 src="img/search1.gif" type=image name="I2">
</form>
<table width="104" height="39" border="0" align="right" cellpadding="0">
<tr>
</tr>
</table>
<table width="100%" height="24" border="0" cellpadding="0" cellspacing="0">
<tr>
<th height="24" scope="col"><div align="right"><a href="pwdmodfiy.asp"><img src="img/xiugai.gif" alt="录入信息" width="162" height="24" border="0"></a></div></th>
<th scope="col"> </th>
</tr>
</table>
<CENTER>
<TABLE border="1" cellspacing="0" width="80%" cellpadding="4" style="border-collapse: collapse" bordercolor="#111111" bordercolorlight="#A6D2FF" bordercolordark="#A6D2FF">
<TR height=44 >
<TD width="76" align="center" ><font color="ff6600"><b>编号</b></font></td>
<TD width="337" align="center" ><strong><font color="ff6600">案件名称</font></strong></td>
<TD width="219" align="center" ><strong><font color="ff6600">调查部门</font></strong></td>
<TD width="58" align="center" ><b>修改</b></TD>
<TD width="54" align="center" ><b>删除</b></TD>
</TR>
<%do while not rs.eof%>
<TR height="20" bgcolor="#ffffff">
<TD width="76" align="left"><%=rs("d_f_id")%> </td>
<TD width="337"><a href="view.asp?d_f_id=<%=rs("d_f_id")%>"><%=rs("d_f_ajmc")%></a></td>
<TD width="219"><%=rs("d_f_dcbm")%></td>
<TD width="58" align="center"><a href="UPDATE.ASP?d_f_id=<%=rs("d_f_id")%>"><img src="img/edit.jpg" alt="修改信息" width="23" height="28" border="0"></a></TD>
<TD width="54" align="center"><a href="confirmdel.asp?d_f_id=<%=rs("d_f_id")%>"><img src="img/delete.gif" alt="删除信息" width="18" height="17" border="0"></a></td>
</TR>
<%i=i+1
IF i>=MaxPerPage then exit do
rs.movenext
loop
%>
</TABLE>
</center>
<div align="center">
<p>
<%
end sub
'定义函数showPage
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
if CurrentPage<2 then
response.write "<table border=0 width=600 cellspacing=0 cellpadding=0>"
response.write "<tr height=30>"
response.write "<td align=left>"
response.write "共<font color=ff6600><b>"&n&"</b></font>页 第<font color=ff6600><b>"&CurrentPage&"</b></font>页 共<font color=ff6600><b>"&totalnumber&"</b></font>条信息</TD>"
response.write "<td align=right>"
response.write "【最前页】【上一页】"
else
response.write "<table border=0 width=800 cellspacing=0 cellpadding=0>"
response.write "<tr height=30>"
response.write "<td align=left>"
response.write "共<font color=ff6600>"&n&"</font>页 第<font color=ff6600>"&CurrentPage&"</font>页 共<font color=ff6600>"&totalnumber&"</font>条信息"
response.write "<td align=right>"
response.write "【<a href="&filename&"?page=1&typeid="&tyeid&"&txtitle="&request("txtitle")&">最前页</a>】"
response.write "【<a href="&filename&"?page="&CurrentPage-1&"&typeid="&typeid&"&txtitle="&request("txtitle")&">上一页</a>】"
end if
if n-currentpage<1 then
response.write "【下一页】【最后页】"
else
response.write "【<a href="&filename&"?page="&(CurrentPage+1)&"&typeid="&typeid&"&txtitle="&request("txtitle")&">"
response.write "下一页</a>】【<a href="&filename&"?page="&n&"&typeid="&typeid&"&txtitle="&request("txtitle")&">最后页</a>】"
end if
response.write "</td>"
response.write "</tr>"
response.write "</table>"
response.write "</form>"
end function
%>
</p>
<p> </p>
</div>
</body>
</html>
[ 本帖最后由 2002070344 于 2007-5-6 00:29 编辑 ]
5 insert插入新个案页面
点击主页面的"新文档资料"链接就进入insert.asp页面它会获取数据库中"案件编号"中的最大值,然后+1作为当前录入页面的编号
当然编号可以自行修改
insert.asp
这个页面是一个纯粹的form,用户填写的数据一会提交到saveinsert.asp处理
saveinsert.asp页面将数据保存到数据库
<body>
<div align="center">
<%
dim sql
dim rs
%>
<% d_f_id=request("d_f_id")
set rs=server.createobject("adodb.recordset")
'生成sql命令
sql="select * from d_file order by d_f_iddesc"
'生成记录集
rs.open sql,conn,1,3
'判断是否有记录
d_f_id=rs("d_f_id")
%>
<img src="img/yemei.jpg"></div>
<form action="SAVEINSERT.ASP" method="post"name="form1" target="_self">
<table width="63%" border="1" align="center" bordercolor="#111111" id="AutoNumber1" style="border-collapse: collapse">
<tr>
<td height="44" colspan="2" background="img/topshort.jpg" ><div align="center" class="STYLE1 STYLE2">行政处罚相对人基本情况</div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080"><span lang="zh-cn">案件编号</span>:</font></div></td>
<td><font color="#FF0000">
<input name="txt_id" type="text" id="txt_id" value="<%=rs("d_f_id")+1%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080"><span lang="zh-cn">案件名称</span>:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_ajmc" type="text" id="txt_ajmc" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080">工商营业执照:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_gszz" type="text" id="txt_gszz" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080">法人代表姓名:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_frdb" type="text" id="txt_frdb" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">个体工商户主姓名:</font></div></td>
<td><font color="#FF0000">
<input name="txt_gthz" type="text" id="txt_gthz" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080">联系电话:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_lxdh" type="text" id="txt_lxdh" size="50">
</font></td>
</tr>
<tr>
<td width="30%"><div align="center"><span class=ap9x><font color="#000080"><span lang="zh-cn">地址</span>:</font></span></div></td>
<td width="70%"><font color="#FF0000">
<input name="txt_dz" type="text" id="txt_dz" size="50">
</font></td>
</tr>
<tr>
<td colspan="2"><div align="left"><span class=ap9x><font color="#000080">案由:</font></span></div></td>
</tr>
<tr>
<td colspan="2"><p><font color="#000080"><span class=ap9x><font color="#000080">
<textarea name="txt_ay" cols="80" rows="10" id="txt_ay"></textarea>
</font></span></font></p>
<p><font color="#000080"><span class=ap9x><font color="#000080"><font color="#000080"><font color="#000080"><font color="#000080">
<input type="submit" name="Submit" value="保存">
</font></font> </font></font></span></font></p></td>
</tr>
</table>
</form>
<div align="center">
<p><a href="index.asp"><img src="img/back.gif" width="90" height="37" border="0"></a></p>
</div>
</body>
saveinsert.asp页面
最后一步还要查询数据库,如果编号已经存在的,就不保存数据到数据库,避免误操作覆盖了原数据
<META c>
<%@ CODEPAGE="936"%>
<!--#include file="inc/dbconn.asp" -->
<%
dim rs
dim sql
'定义接收数据的临时变量
dim d_f_id
dim d_f_ajmc
dim d_f_gszz
dim d_f_frdb
dim d_f_gthz
dim d_f_dz
dim d_f_ay
dim d_f_lxdh
'接收数据
d_f_id=request.Form("txt_id")
d_f_ajmc=request.Form("txt_ajmc")
d_f_gszz=request.Form("txt_gszz")
d_f_frdb=request.Form("txt_frdb")
d_f_gthz=request.Form("txt_gthz")
d_f_dz=request.Form("txt_dz")
d_f_ay=request.Form("txt_ay")
d_f_lxdh=request.Form("txt_lxdh")
'查询是否有相同号的信息,若没有则录入
set rs=server.CreateObject("ADODB.RecordSet")
sql="select * from d_file where d_f_id="&d_f_id
rs.open sql,conn,3,2
if rs.eof then
'录入新信息
rs.addnew
rs("d_f_id")=d_f_id
rs("d_f_ajmc")=d_f_ajmc
rs("d_f_gszz")=d_f_gszz
rs("d_f_frdb")=d_f_frdb
rs("d_f_gthz")=d_f_gthz
rs("d_f_dz")=d_f_dz
rs("d_f_ay")=d_f_ay
rs("d_f_lxdh")=d_f_lxdh
rs.update
response.write "录入成功"
else
response.write "已有相同编号的文档存在!"
response.write ("<script>alert('已有相同编号的文档存在!')</script>")
end if
rs.close
set rs=nothing
response.redirect "index.asp"
%>
[ 本帖最后由 2002070344 于 2007-5-6 00:48 编辑 ]
6 modfiy修改页面
插入了新文档之后,我们可以通过主页面上对应修改链接对其做详细的填写.由于用户事务流程比较复杂,有分叉的情况发生,也就是说事情发展有多种情况,
设计要提供分支表单以供填写,同时,为了页面美观,页面同一时间只能显示一个分支,
也就是说,打开其中一个分支,其余已经打开的分支就要收起来(隐藏起来)
update.asp页面
这个页面也纯粹是个form
只是为了体现分支事务的选择
而多加了蓝色字体的javescript语句对展开分支进行处理
保证同一时间只展开一个分支
按下"提交"按钮后,表单转到saveupdate.asp页面处理
<META c>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/dbconn.asp" -->
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<body bgcolor="#FFFFFF" marginheight=0 marginwidth=0 leftmargin=0>
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>您正在添加、修改编号<%=request("d_f_id")%>的记录</title>
<div align="center">
<%
if not isEmpty(request("d_f_id")) then
d_f_id=request("d_f_id")
else
d_f_id=1
end if
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from d_file where d_f_id="&d_f_id
rs.open sql,conn,1,1
%>
<body>
<img src="img/yemei.jpg">
</div>
<table width="380" border="0" align="center" cellpadding="0">
<tr>
<td><div align="center">您正在添加、修改编号<span class="STYLE1"><%=request("d_f_id")%></span>的记录</div></td>
</tr>
</table>
<form action="SAVEUPDATE.asp?d_f_id=<%=rs("d_f_id")%> " method="post"" name="form1" target="_parent"post>
<table width="63%" border="1" align="center" cellspacing="0" bordercolor="#111111" id="AutoNumber1" style="border-collapse: collapse">
<tr>
<td height="44" colspan="2" background="img/topshort.jpg"><div align="center" class="STYLE1">行政处罚相对人基本情况</div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080"><span lang="zh-cn">案件编号</span>:</font></div></td>
<td><font color="#FF0000">
<input name="txt_id" type="text" id="txt_id" value="<%=rs("d_f_id")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080"><span lang="zh-cn">案件名称</span>:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_ajmc" type="text" id="txt_ajmc" value="<%=rs("d_f_ajmc")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080">工商营业执照:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_gszz" type="text" id="txt_gszz" value="<%=rs("d_f_gszz")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080">法人代表姓名:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_frdb" type="text" id="txt_frdb" value="<%=rs("d_f_frdb")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">个体工商户主姓名:</font></div></td>
<td><font color="#FF0000">
<input name="txt_gthz" type="text" id="txt_gthz" value="<%=rs("d_f_gthz")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080"><span lang="zh-cn">联系电话</span>:</font></div></td>
<td><font color="#FF0000">
<input name="txt_lxdh" type="text" id="txt_lxdh" value="<%=rs("d_f_lxdh")%>" size="50">
</font></td>
</tr>
<tr>
<td width="30%"><div align="center"><span class=ap9x><font color="#000080"><span lang="zh-cn">地址</span>:</font></span></div></td>
<td width="70%"><font color="#FF0000">
<input name="txt_dz" type="text" id="txt_dz" value="<%=rs("d_f_dz")%>" size="50">
</font></td>
</tr>
<tr>
<td colspan="2"><span class=ap9x><font color="#000080"> 案由:</font></span></td>
</tr>
<tr>
<td colspan="2"><p><font color="#000080"><span class=ap9x><font color="#000080">
<textarea name="txt_ay" cols="80" rows="10" id="txt_ay"><%=rs("d_f_ay")%></textarea>
</font></span></font></p>
<p> </p></td>
</tr>
<tr>
<td height="44" colspan="2" background="img/topshort.jpg"><div align="center"><span class="STYLE1">调查、领导审批阶段</span></div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">调查部门:</font></div></td>
<td><font color="#FF0000">
<input name="txt_dcbm" type="text" id="txt_dcbm" value="<%=rs("d_f_dcbm")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080"><span lang="zh-cn">调查人员</span>:</font></div></td>
<td><font color="#FF0000">
<input name="txt_dcry" type="text" id="txt_dcry" value="<%=rs("d_f_dcry")%>" size="50">
</font></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#000080"><span lang="zh-cn">检查时间</span>:</font></div></td>
<td><font color="#FF0000">
<input name="txt_jcsj" type="text" id="txt_jcsj" value="<%=rs("d_f_jcsj")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">立案时间:</font></div></td>
<td><font color="#FF0000">
<input name="txt_lasj" type="text" id="txt_lasj" value="<%=rs("d_f_lasj")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">调查终止报告时间:</font></div></td>
<td><font color="#FF0000">
<input name="txt_dcbg" type="text" id="txt_dcbg" value="<%=rs("d_f_dcbg")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">移送法规科时间:</font></div></td>
<td><font color="#FF0000">
<input name="txt_yssj" type="text" id="txt_yssj" value="<%=rs("d_f_yssj")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">科长审批时间:</font></div></td>
<td><font color="#FF0000">
<input name="txt_kzsp" type="text" id="txt_kzsp" value="<%=rs("d_f_kzsp")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">主管局长审批时间:</font></div></td>
<td><font color="#FF0000">
<input name="txt_jzsp" type="text" id="txt_jzsp" value="<%=rs("d_f_jzsp")%>" size="50">
</font></td>
</tr>
</table>
<div align="center"><img src="img/fencha.jpg" width="844" height="148">
</div>
<script>
function divswitcher1(){
table1.style.display =(table1.style.display=="none")?"block":"none";
table2.style.display ="none"
table3.style.display ="none"
yiban.style.display ="none"
shenbian.style.display ="none"
tingzheng.style.display ="none"
jueding.style.display ="none"}
function divswitcher2(){
table2.style.display =(table2.style.display=="none")?"block":"none";
table1.style.display ="none"
table3.style.display ="none"
}
function divswitcher3(){
table3.style.display =(table3.style.display=="none")?"block":"none";
table1.style.display ="none"
table2.style.display ="none"
yiban.style.display ="none"
shenbian.style.display ="none"
tingzheng.style.display ="none"
jueding.style.display ="none"}
</script>
<div align="center">
<table width="100%" height="50" border="0" bordercolor="#111111" background="img/topic.jpg">
<tr>
<td width="33%" height="44" bordercolor="#FFFFFF" >
<div align="center"><a href="javascript:divswitcher1('table1');">上报市政府限期治理</a> </div></td>
<td width="33%"><div align="center"><span class="STYLE1">
<a href="javascript:divswitcher2('table2');">告知书阶段</a></span></div></td>
<td width="33%"><div align="center"><span class="STYLE1">
<a href="javascript:divswitcher3('table3');">撤销案件</a></span></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" id="table1" style="display:none; ">
<tr>
<td><table width="33%" border="1" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="33%"><div align="center"><font color="#000080">上报市政府限期治理时间:</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_sbzf" type="text" id="txt_sbzf" value="<%=rs("d_f_sbzf")%>" size="38">
</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">市政府下告知书时间:</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#FF0000">
<input name="txt_zfgzsj" type="text" id="txt_zfgzsj" value="<%=rs("d_f_zfgzsj")%>" size="38">
</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#000080">请示市政府下决定书时间:</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_qszfsj" type="text" id="txt_qszfsj" value="<%=rs("d_f_qszfsj")%>" size="38">
</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">市政府下决定书时间:</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_zfjdsj" type="text" id="txt_zfjdsj" value="<%=rs("d_f_zfjdsj")%>" size="38">
</font></div></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" id="table3" style="display:none; ">
<tr>
<td><table width="33%" height="257" border="1" align="right" cellspacing="0">
<tr>
<td colspan="2"><div align="center"><font color="#000080">备注:</font></div></td>
</tr>
<tr>
<td height="234" colspan="2"><font color="#000080"><font color="#000080">
<textarea name="txt_bz" cols="42" rows="14" id="txt_bz"><%=rs("d_f_bz")%></textarea>
</font></font></td>
</tr>
</table></td>
</tr>
</table>
</div>
<div align="center" id=table2 style="display:none; ">
<table width="33%" border="1" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><font color="#000080">告知书文号:</font></div></td>
</tr>
<tr>
<td><font color="#FF0000">
<input name="txt_gzwh" type="text" id="txt_gzwh" value="<%=rs("d_f_gzwh")%>" size="38">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">告知书发出时间</font>:</div></td>
</tr>
<tr>
<td><font color="#FF0000">
<input name="txt_gzsj" type="text" id="txt_gzsj" value="<%=rs("d_f_gzsj")%>" size="38">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">告知书送达时间:</font></div></td>
</tr>
<tr>
<td><font color="#FF0000">
<input name="txt_gzsd" type="text" id="txt_gzsd" value="<%=rs("d_f_gzsd")%>" size="38">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">告知书内容:</font></div></td>
</tr>
<tr>
<td><label>
<textarea name="txt_gznr" cols="42" rows="10" id="txt_gznr"><%=rs("d_f_gznr")%></textarea>
</label></td>
</tr>
</table>
<img src="img/fencha.jpg" width="844" height="148">
<table width="100%" height="40" border="0" align="center" background="img/topic.jpg" id="table" style="display:block; ">
<tr>
<td width="33%"><div align="center"><a href="javascript:divswitcher4('yiban');">一般案件</a></div></td>
<td width="33%"><div align="center"><a href="javascript:divswitcher5('shenbian');">提出申辩的案件</a></div></td>
<td width="33%"><div align="center"><a href="javascript:divswitcher6('tingzheng');">提出听证的案件</a></div></td>
</tr>
</table>
</div>
<script>
function divswitcher4(){
yiban.style.display =(yiban.style.display=="none")?"block":"none";
shenbian.style.display ="none"
tingzheng.style.display ="none"
jueding.style.display ="none"}
function divswitcher5(){
shenbian.style.display =(shenbian.style.display=="none")?"block":"none";
yiban.style.display ="none"
tingzheng.style.display ="none"
jueding.style.display ="none"}
function divswitcher6(){
tingzheng.style.display =(tingzheng.style.display=="none")?"block":"none";
yiban.style.display ="none"
shenbian.style.display ="none"
jueding.style.display ="none"}
</script>
<table width="100%" border="0" cellpadding="0" id=yiban style="display:none; ">
<tr>
<td><table width="33%" border="1" cellpadding="0">
<tr>
<td><div align="center"><font color="#000080">副本送审(张科):</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_fbkz" type="text" id="txt_fbkz" value="<%=rs("d_f_fbkz")%>" size="38">
</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">副本送审(黄局):</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#FF0000">
<input name="txt_fbfj" type="text" id="txt_fbfj" value="<%=rs("d_f_fbfj")%>" size="38">
</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#000080">副本送审(王局):</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_fbzj" type="text" id="txt_fbzj" value="<%=rs("d_f_fbzj")%>" size="38">
</font></div></td>
</tr>
<tr>
<td background="img/jueding.jpg"><div align="center"><a href="javascript:divswitcher7('jueding');">决定书阶段</a></div></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" id=shenbian style="display:none; ">
<tr>
<td><table width="33%" border="1" align="center" cellspacing="0"style="display:block; ">
<tr>
<td width="33%"><div align="center"><font color="#000080">提出陈述申辩时间:</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_sbsj" type="text" id="txt_sbsj" value="<%=rs("d_f_sbsj")%>" size="38">
</font></div></td>
</tr>
<tr>
<td background="img/jueding.jpg"><div align="center"><a href="javascript:divswitcher7('jueding');">决定书阶段</a></div></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" id=tingzheng style="display:none; ">
<tr>
<td><table width="33%" border="1" align="right" cellspacing="0"id="table23" style="display:block; ">
<tr>
<td width="33%"><div align="center"><font color="#000080">申请听证时间:</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_sqtz" type="text" id="txt_sqtz" value="<%=rs("d_f_sqtz")%>" size="38">
</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">听证会召开时间:</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_tzsj" type="text" id="txt_tzsj" value="<%=rs("d_f_tzsj")%>" size="38">
</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">听证会召开地点:</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_tzdd" type="text" id="txt_tzdd" value="<%=rs("d_f_tzdd")%>" size="38">
</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">听证会参加人员:</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000">
<input name="txt_tzry" type="text" id="txt_tzry" value="<%=rs("d_f_tzry")%>" size="38">
</font></div></td>
</tr>
<tr>
<td background="img/jueding.jpg"><div align="center"><a href="javascript:divswitcher7('jueding');">决定书阶段</a></div></td>
</tr>
</table></td>
</tr>
</table>
</div>
<script>
function divswitcher7(){
jueding.style.display =(jueding.style.display=="none")?"block":"none";
}
</script>
<table width="33%" border="1" align="center" id=jueding style="display:none; ">
<tr>
<td><div align="center"><font color="#000080">决定书文号:</font></div></td>
</tr>
<tr>
<td><label>
<div align="center"><font color="#FF0000">
<input name="txt_jdwh" type="text" id="txt_jdwh" value="<%=rs("d_f_jdwh")%>" size="38">
</font></div>
</label></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#000080">决定书发出时间:</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#FF0000">
<input name="txt_jdfc" type="text" id="txt_jdfc" value="<%=rs("d_f_jdfc")%>" size="38">
</font></div></td>
</tr>
<tr>
<td width="33%" height="20"><div align="center"><font color="#000080">决定书送达时间:</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#FF0000">
<input name="txt_jdsd" type="text" id="txt_jdsd" value="<%=rs("d_f_jdsd")%>" size="38">
</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#000080">处罚金额:</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#FF0000">
<input name="txt_cfje" type="text" id="txt_cfje" value="<%=rs("d_f_cfje")%>" size="38">
</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#000080">罚款缴交时间:</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#FF0000">
<input name="txt_jjsj" type="text" id="txt_jjsj" value="<%=rs("d_f_jjsj")%>" size="38">
</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#000080">补办手续时间:</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#FF0000">
<input name="txt_bbsj" type="text" id="txt_bbsj" value="<%=rs("d_f_bbsj")%>" size="38">
</font></div></td>
</tr>
<tr>
<td height="20"><div align="center"><font color="#000080">未缴交罚款的,申请法院强制时间:</font></div></td>
</tr>
<tr>
<td width="33%" height="20"><div align="center"><font color="#FF0000">
<input name="txt_sqfy" type="text" id="txt_sqfy" value="<%=rs("d_f_sqfy")%>" size="38">
</font></div></td>
</tr>
</table>
<table width="33%" border="0" align="center" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td><label>
<div align="center">
<input type="submit" name="Submit" value="保存">
</div>
</label></td>
</tr>
</table>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="center"><a href="index.asp"><img src="img/back.gif" width="90" height="37" border="0"></a> </p>
</form>
</body>
</html>
saveupdate.asp页面
该页面的作用就是将update传递过来的数据保存到数据库中
<META c>
<%@ codepage ="936" %>
<!--#include file="inc/dbconn.asp" -->
<%
'定义接收UPDATE.ASP文件传送的值的临时变量
dim d_f_id
dim d_f_ajmc
dim d_f_gszz
dim d_f_frdb
dim d_f_gthz
dim d_f_dz
dim d_f_ay
dim d_f_dcbm
dim d_f_dcry
dim d_f_jcsj
dim d_f_lasj
dim d_f_dcbg
dim d_f_yssj
dim d_f_kzsp
dim d_f_jzsp
dim d_f_gznr
dim d_f_gzsj
dim d_f_gzsd
dim d_f_sbsj
dim d_f_sqtz
dim d_f_tzsj
dim d_f_fbkz
dim d_f_fbfj
dim d_f_fbzj
dim d_f_jdnr
dim d_f_jdfc
dim d_f_jdsd
dim d_f_cfje
dim d_f_jjsj
dim d_f_sqfy
dim d_f_sbzf
dim d_f_bz
dim d_f_zfgzsj
dim d_f_qszfsj
dim d_f_zfjdsj
dim d_f_bbsj
dim d_f_gzwh
dim d_f_jdwh
dim d_f_lzdh
dim d_f_tzdd
dim d_f_tzry
'接收UPDATE.ASP文件传送的值
d_f_id=request.Form("txt_id")
d_f_ajmc=request.Form("txt_ajmc")
d_f_gszz=request.Form("txt_gszz")
d_f_frdb=request.Form("txt_frdb")
d_f_gthz=request.Form("txt_gthz")
d_f_dz=request.Form("txt_dz")
d_f_ay=request.Form("txt_ay")
d_f_dcbm=request.Form("txt_dcbm")
d_f_dcry=request.Form("txt_dcry")
d_f_jcsj=request.Form("txt_jcsj")
d_f_lasj=request.Form("txt_lasj")
d_f_dcbg=request.Form("txt_dcbg")
d_f_yssj=request.Form("txt_yssj")
d_f_kzsp=request.Form("txt_kzsp")
d_f_jzsp=request.Form("txt_jzsp")
d_f_gznr=request.Form("txt_gznr")
d_f_gzsj=request.Form("txt_gzsj")
d_f_gzsd=request.Form("txt_gzsd")
d_f_sbsj=request.Form("txt_sbsj")
d_f_sqtz=request.Form("txt_sqtz")
d_f_tzsj=request.Form("txt_tzsj")
d_f_fbkz=request.Form("txt_fbkz")
d_f_fbfj=request.Form("txt_fbfj")
d_f_fbzj=request.Form("txt_fbzj")
d_f_jdnr=request.Form("txt_jdnr")
d_f_jdfc=request.Form("txt_jdfc")
d_f_jdsd=request.Form("txt_jdsd")
d_f_cfje=request.Form("txt_cfje")
d_f_jjsj=request.Form("txt_jjsj")
d_f_sqfy=request.Form("txt_sqfy")
d_f_sbzf=request.Form("txt_sbzf")
d_f_bz=request.Form("txt_bz")
d_f_zfgzsj=request.Form("txt_zfgzsj")
d_f_qszfsj=request.Form("txt_qszfsj")
d_f_zfjdsj=request.Form("txt_zfjdsj")
d_f_bbsj=request.Form("txt_bbsj")
d_f_gzwh=request.Form("txt_gzwh")
d_f_jdwh=request.Form("txt_jdwh")
d_f_lxdh=request.Form("txt_lxdh")
d_f_tzdd=request.Form("txt_tzdd")
d_f_tzry=request.Form("txt_tzry")
'接收产生记录集
set rs=server.createobject("adodb.recordset")
sql="select * from d_file where d_f_id="&d_f_id
response.write sql
rs.open sql,conn,1,3
'更新记录集中字段的值
rs("d_f_id")=d_f_id
rs("d_f_ajmc")=d_f_ajmc
rs("d_f_gszz")=d_f_gszz
rs("d_f_frdb")=d_f_frdb
rs("d_f_gthz")=d_f_gthz
rs("d_f_dz")=d_f_dz
rs("d_f_ay")=d_f_ay
rs("d_f_dcbm")=d_f_dcbm
rs("d_f_dcry")=d_f_dcry
rs("d_f_jcsj")=d_f_jcsj
rs("d_f_lasj")=d_f_lasj
rs("d_f_dcbg")=d_f_dcbg
rs("d_f_yssj")=d_f_yssj
rs("d_f_kzsp")=d_f_kzsp
rs("d_f_jzsp")=d_f_jzsp
rs("d_f_gznr")=d_f_gznr
rs("d_f_gzsj")=d_f_gzsj
rs("d_f_gzsd")=d_f_gzsd
rs("d_f_sbsj")=d_f_sbsj
rs("d_f_sqtz")=d_f_sqtz
rs("d_f_tzsj")=d_f_tzsj
rs("d_f_fbkz")=d_f_fbkz
rs("d_f_fbfj")=d_f_fbfj
rs("d_f_fbzj")=d_f_fbzj
rs("d_f_jdnr")=d_f_jdnr
rs("d_f_jdfc")=d_f_jdfc
rs("d_f_jdsd")=d_f_jdsd
rs("d_f_cfje")=d_f_cfje
rs("d_f_jjsj")=d_f_jjsj
rs("d_f_sqfy")=d_f_sqfy
rs("d_f_sbzf")=d_f_sbzf
rs("d_f_bz")=d_f_bz
rs("d_f_zfgzsj")=d_f_zfgzsj
rs("d_f_qszfsj")=d_f_qszfsj
rs("d_f_zfjdsj")=d_f_zfjdsj
rs("d_f_bbsj")=d_f_bbsj
rs("d_f_gzwh")=d_f_gzwh
rs("d_f_jdwh")=d_f_jdwh
rs("d_f_lxdh")=d_f_lxdh
rs("d_f_tzdd")=d_f_tzdd
rs("d_f_tzry")=d_f_tzry
'提交更新值
rs.update
rs.close
set rs=noting
conn.close
set conn=nothing
'返回查询显示页面index.asp
response.redirect "index.asp"
%>
[ 本帖最后由 2002070344 于 2007-5-6 01:14 编辑 ]
7 查看事务进展页面
该页面按照设计要求:事务进展到哪里就显示到哪里
尚未发展到哪一步的事务就不要显示出来
实现的方法就是判断事务段的第一个填写数据有没值
没有值的话就不显示出来,有值才能显示
也就是说尚未填写就是尚未发生,尚未发生就不显示出来
ps:如果要求设计得严密些,也可以多判断多几个字段,再决定要不要显示出来
view.asp页面
<META c>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/dbconn.asp" -->
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
<!--
.STYLE3 {color: #0000FF; }
.STYLE7 {color: #000000}
.STYLE9 {font-size: 24px; font-family: "宋体"; }
.STYLE10 {color: #333333}
.STYLE12 {font-size: 24px}
-->
</style>
<body bgcolor="#FFFFFF" marginheight=0 marginwidth=0 leftmargin=0>
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>您正在浏览编号<%=request("d_f_id")%>的记录</title>
<div align="center">
<%
if not isEmpty(request("d_f_id")) then
d_f_id=request("d_f_id")
else
d_f_id=1
end if
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from d_file where d_f_id="&d_f_id
rs.open sql,conn,1,1
%>
<body>
<img src="img/yemei.jpg">
</div>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<th height="44" colspan="4" scope="col" background="img/topic.jpg"><div align="center" class="STYLE12">案件编号<%=request("d_f_id")%>的基本情况</div></th>
</tr>
<tr>
<td width="19%"><div align="center">案件名称:</div></td>
<td colspan="3"> <%=rs("d_f_ajmc")%></td>
</tr>
<tr>
<td><div align="center">工商营业执照号:</div></td>
<td width="32%"> <%=rs("d_f_gszz")%></td>
<td width="18%"><div align="center">个体工商户主姓名:</div></td>
<td width="31%"> <%=rs("d_f_gthz")%></td>
</tr>
<tr>
<td><div align="center">法人代表姓名:</div></td>
<td> <%=rs("d_f_frdb")%></td>
<td><div align="center">地址:</div></td>
<td> <%=rs("d_f_dz")%></td>
</tr>
<tr>
<td><div align="center">联系电话:</div></td>
<td colspan="3"> <%=rs("d_f_lxdh")%></td>
</tr>
<tr>
<td><div align="center">案由:</div></td>
<td colspan="3"> <%=rs("d_f_ay")%></td>
</tr>
<tr>
<td><div align="center">调查部门:</div></td>
<td> <%=rs("d_f_dcbm")%></td>
<td><div align="center">调查人员:</div></td>
<td> <%=rs("d_f_dcry")%></td>
</tr>
<tr>
<td><div align="center">检查时间:</div></td>
<td> <%=rs("d_f_jcsj")%></td>
<td><div align="center">立案时间:</div></td>
<td> <%=rs("d_f_lasj")%></td>
</tr>
<tr>
<td><div align="center">调查终止报告时间:</div></td>
<td> <%=rs("d_f_dcbg")%></td>
<td><div align="center">移送法规科时间:</div></td>
<td> <%=rs("d_f_yssj")%></td>
</tr>
<tr>
<td><div align="center">主管局长审批时间:</div></td>
<td> <%=rs("d_f_zjsp")%></td>
<td><div align="center">科长审批时间:</div></td>
<td> <%=rs("d_f_kzsp")%></td>
</tr>
</table>
<% if rs("d_f_sbzf")<>"" then%>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="44" colspan="4" background="img/topic.jpg"><div align="center"><span class="STYLE9">上报市政府限期治理</span></div></td>
</tr>
<tr>
<td width="23%"><div align="center" class="STYLE7">
<div align="center">上报市政府限期治理时间:</div>
</div></td>
<td width="28%"> <%=rs("d_f_sbzf")%></td>
<td width="21%"><div align="center" class="STYLE7"><span class="STYLE7">市政府下告知书时间:</span></div></td>
<td width="28%"> <%=rs("d_f_zfgzsj")%></td>
</tr>
<tr>
<td height="20"><div align="center" class="STYLE7">
<div align="center">请示市政府下决定书时间:</div>
</div></td>
<td height="20"> <%=rs("d_f_qszfsj")%></td>
<td height="20"><div align="center" class="STYLE7"><span class="STYLE7">市政府下决定书时间:</span></div></td>
<td height="20"> <%=rs("d_f_zfjdsj")%></td>
</tr>
</table>
<%end if%>
<% if rs("d_f_bz")<>"" then%>
<table width="100%" border="1" cellspacing="0">
<tr>
<td height="44" colspan="2" background="img/topic.jpg"><div align="center"><span class="STYLE9">撤销案件</span></div></td>
</tr>
<tr>
<td width="23%"><div align="center"><span class="STYLE3 STYLE7">备注:</span></div></td>
<td width="77%"> <%=rs("d_f_bz")%></td>
</tr>
</table>
<%end if%>
<% if rs("d_f_gzwh")<>"" then%>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="44" colspan="4" background="img/topic.jpg"><div align="center"><span class="STYLE9">告知书阶段</span></div></td>
</tr>
<tr>
<td width="23%"><div align="center" class="STYLE7">告知书文号:</div></td>
<td colspan="3"> <%=rs("d_f_gzwh")%></td>
</tr>
<tr>
<td height="20"><div align="center"><span class="STYLE7">告知书发出时间:</span></div></td>
<td width="29%" height="20"> <%=rs("d_f_gzsj")%></td>
<td width="20%" height="20"><div align="center" class="STYLE7">告知书送达时间:</div></td>
<td width="28%" height="20"> <%=rs("d_f_gzsd")%></td>
</tr>
<tr>
<td height="20"><div align="center"><span class="STYLE10">告知书内容:</span></div></td>
<td height="20" colspan="3"> <%=rs("d_f_gznr")%></td>
</tr>
</table>
<%end if%>
<% if rs("d_f_fbkz")<>"" then%>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="44" colspan="4" background="img/topic.jpg"><div align="center"><span class="STYLE9">一般案件</span></div></td>
</tr>
<tr>
<td width="23%"><div align="center" class="STYLE7">副本送审(张科):</div></td>
<td width="29%"> <%=rs("d_f_fbkz")%></td>
<td width="20%"><div align="center"><span class="STYLE7">副本送审(黄局):</span></div></td>
<td width="28%"> <%=rs("d_f_fbfj")%></td>
</tr>
<tr>
<td height="20"><div align="center" class="STYLE7">副本送审(王局):</div></td>
<td height="20" colspan="3"> <%=rs("d_f_fbzj")%></td>
</tr>
</table>
<%end if%>
<% if rs("d_f_sbsj")<>"" then%>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="44" colspan="2" background="img/topic.jpg"><div align="center"><span class="STYLE9">提出申辩的案件</span></div></td>
</tr>
<tr>
<td width="23%"><div align="center" class="STYLE7">提出陈述申辩时间:</div></td>
<td> <%=rs("d_f_sbsj")%> </td>
</tr>
</table>
<%end if%>
<% if rs("d_f_sqtz")<>"" then%>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="44" colspan="4" background="img/topic.jpg"><div align="center"><span class="STYLE9">提出听证的案件</span></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE7">申请听证时间:</div></td>
<td> <%=rs("d_f_sqtz")%></td>
<td><div align="center"><span class="STYLE7">听证会召开时间:</span></div></td>
<td> <%=rs("d_f_tzsj")%></td>
</tr>
<tr>
<td width="23%"><div align="center" class="STYLE7">听证会召开地点:</div></td>
<td width="29%"> <%=rs("d_f_tzdd")%></td>
<td width="20%"><div align="center"><span class="STYLE7">听证会参加人员:</span></div></td>
<td width="28%"> <%=rs("d_f_tzry")%></td>
</tr>
</table>
<%end if%>
<% if rs("d_f_jdwh")<>"" then%>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="44" colspan="4" background="img/topic.jpg"><div align="center"><span class="STYLE9">决定书阶段</span></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE7">决定书文号:</div></td>
<td colspan="3"> <%=rs("d_f_jdwh")%></td>
</tr>
<tr>
<td width="23%"><div align="center"><span class="STYLE7">决定书发出时间:</span></div></td>
<td width="29%"> <%=rs("d_f_jdfc")%></td>
<td width="20%"><div align="center" class="STYLE7">决定书送达时间:</div></td>
<td width="28%"> <%=rs("d_f_jdsd")%></td>
</tr>
<tr>
<td height="20"><div align="center" class="STYLE7">处罚金额:</div></td>
<td height="20"> <%=rs("d_f_cfje")%></td>
<td height="20"><div align="center"><span class="STYLE10">罚款缴交时间:</span></div></td>
<td height="20"> <%=rs("d_f_jjsj")%></td>
</tr>
<tr>
<td height="20"><div align="center" class="STYLE7">补办手续时间:</div></td>
<td height="20"> <%=rs("d_f_bbsj")%></td>
<td height="20"><div align="center"><span class="STYLE10">未缴交罚款的,申请法院强制时间:</span></div></td>
<td height="20"> <%=rs("d_f_sqfy")%></td>
</tr>
</table>
<%end if%>
<p> </p>
<div align="center">
<p><a href="index.asp"><img src="img/back.gif" width="90" height="37" border="0"></a></p>
</div>
</body>
</html>
[ 本帖最后由 2002070344 于 2007-5-6 01:28 编辑 ]
8 delete删除记录页面
该页面作用是对数据库进行操作,对相应的条目进行删除记录的处理为了保障数据的安全避免误操作,
每次进行删除操作之前,我们将数据显示出来,然后用户确认是否要删除
按下确认删除之后,才真正进行删除动作
confirmdel.asp
<META c>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/dbconn.asp" -->
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<body bgcolor="#FFFFFF" marginheight=0 marginwidth=0 leftmargin=0>
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>您将要删除编号<%=request("d_f_id")%>的记录?</title>
<div align="center">
<%
if not isEmpty(request("d_f_id")) then
d_f_id=request("d_f_id")
else
d_f_id=1
end if
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from d_file where d_f_id="&d_f_id
rs.open sql,conn,1,1
%>
<body>
<img src="img/yemei.jpg">
</div>
<table width="380" border="0" align="center" cellpadding="0">
<tr>
<td><div align="center">您将要删除编号<%=request("d_f_id")%>的记录?</div></td>
</tr>
</table>
<form action="delete.asp?d_f_id=<%=rs("d_f_id")%> " method="post"" name="form1" target="_parent"post>
<table width="63%" border="1" align="center" cellspacing="0" bordercolor="#111111" id="AutoNumber1" style="border-collapse: collapse">
<tr>
<td height="44" colspan="2" background="img/topshort.jpg"><div align="center" class="STYLE1">案件基本情况</div></td>
</tr>
<tr>
<td><div align="center"><font color="#000080"><span lang="zh-cn">案件编号</span>:</font></div></td>
<td><font color="#FF0000">
<input name="txt_id" type="text" id="txt_id" value="<%=rs("d_f_id")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080"><span lang="zh-cn">案件名称</span>:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_ajmc" type="text" id="txt_ajmc" value="<%=rs("d_f_ajmc")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080">工商营业执照:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_gszz" type="text" id="txt_gszz" value="<%=rs("d_f_gszz")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><span class=ap9x><font color="#000080">法人代表姓名:</font></span></div></td>
<td><font color="#FF0000">
<input name="txt_frdb" type="text" id="txt_frdb" value="<%=rs("d_f_frdb")%>" size="50">
</font></td>
</tr>
<tr>
<td><div align="center"><font color="#000080">个体工商户主姓名:</font></div></td>
<td><font color="#FF0000">
<input name="txt_gthz" type="text" id="txt_gthz" value="<%=rs("d_f_gthz")%>" size="50">
</font></td>
</tr>
<tr>
<td width="30%"><div align="center"><span class=ap9x><font color="#000080"><span lang="zh-cn">地址</span>:</font></span></div></td>
<td width="70%"><font color="#FF0000">
<input name="txt_dz" type="text" id="txt_dz" value="<%=rs("d_f_dz")%>" size="50">
</font></td>
</tr>
<tr>
<td colspan="2"><span class=ap9x><font color="#000080">案由:</font></span></td>
</tr>
<tr>
<td colspan="2"><p><font color="#000080"><span class=ap9x><font color="#000080">
<textarea name="txt_ay" cols="80" rows="10" id="txt_ay"><%=rs("d_f_ay")%></textarea>
</font></span></font></p>
<p> </p></td>
</tr>
</table>
<div align="center">
<input type="submit" name="Submit" value="确认删除">
</div>
</label></td>
</tr>
</table>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="center"><a href="index.asp"><img src="img/back.gif" width="90" height="37" border="0"></a> </p>
</form>
</body>
</html>
delete.asp页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/dbconn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>删除编号:<%=request("d_f_id")%>的资料</title>
</head>
<body>
<%
dim rs,sql
dim d_f_id
d_f_id=request("d_f_id")
set rs=server.createobject("adodb.recordset")
sql="delete from d_file where d_f_id="&d_f_id
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
else
response.redirect"index.ASP"
end if
rs.close
set rs=nothing
%>
</body>
</html>
[ 本帖最后由 2002070344 于 2007-5-6 01:37 编辑 ]
9 其他部分页面与总结
其他部分页面主要是授权浏览者能访问的页面和密码修改页面这几个页面都和管理者页面相对应
只是有些功能或者链接被删除了
所以这些页面的制作也是在管理者访问页面的基础上修改的
还有一个页面上面忘记提起的是数据库链接配置页面
dbconn.asp页面
由注释部分可以看出,如果升级数据库为SQL的话,只须改动该文件即可
其他页面不需要改动
<%
dim conn
dim connstr
on error resume next
'如果是Access数据库,直接指定驱动则使用下面的连接
c+server.mappath("inc/fgkdate/dbfgk.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
'如果是Access数据库,使用系统DSN则使用下面的连接,DSN的名称需要根据实际建立的名称进行更改
'c
'如果是SQL Server 2000数据库,直接指定驱动则使用下面的连接,Server参数、UID参数、PWD参数、database参数请根据自己的环境进行修改
'c
'如果是SQL Server 2000数据库,使用系统DSN则使用下面的连接,DSN的名称需要根据实际建立的名称进行更改
'c
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>
总结:待续
[ 本帖最后由 2002070344 于 2007-5-6 01:47 编辑 ] 后院编程版就是缺这些帖子。 学号还是这么热心
其实编程的话环境很重要,学编程首先搭个环境比看十本书都重要。。。
以前在学校一直很懒,到工作无可奈何有时候也得写一些script,写来写去觉得也不像想象中那么难,所以我现在觉得环境最重要。 好,辛苦了。 为什么不选择PHP+MYSQL ?
asp+Access ...... 非常敬佩楼主的专业精神,毕竟现在能够静下心来学习的人不多。向楼主学习!
页:
[1]