| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 514 人关注过本帖
标题:[求助]能添加但不能修改
只看楼主 加入收藏
siulem
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-10-23
收藏
 问题点数:0 回复次数:1 
[求助]能添加但不能修改

<!--#include file="conn.asp"-->
<%
if session("admin")="" then
response.redirect "admin.asp"
end if
%>
<!--#include file="char.asp"-->
<%
dim rs,sql
dim qihao
dim bianhao
dim riqi
dim maizhu
dim maijin
dim zhongzhu
dim zhongjin
dim zhongyi
dim zhonger
dim zhongsan
dim zhongsi
dim zhongwu
dim zhongliu
dim hongqiu
dim lanqiu
dim tebie
dim qita
dim errmsg
dim founderr
founderr=false
if trim(request.form("qihao"))="" then
founderr=true
errmsg="<li>彩票期号不能为空</li>"
end if
if trim(request.form("riqi"))="" then
founderr=true
errmsg="<li>开奖日期不能为空</li>"
end if

if founderr=false then
qihao=htmlencode(request.form("qihao"))

set rs=server.createobject("adodb.recordset")
if request("action")="add" then
call newsoft()
elseif request("action")="edit" then
call editsoft()
else
founderr=true
errmsg=errmsg+"<li>没有选定参数</li>"
end if
sub newsoft()
sql="select * from caipiao where (bianhao is null)"
rs.open sql,conn,1,3
rs.addnew
rs("qihao")=qihao
if request.form("qita")<>"" then
rs("qita")=trim(request.form("qita"))
end if
if request.form("maizhu")<>"" then
rs("maizhu")=trim(request.form("maizhu"))
end if
if request.form("maijin")<>"" then
rs("maijin")=trim(request.form("maijin"))
end if
if request.form("zhongzhu")<>"" then
rs("zhongzhu")=trim(request.form("zhongzhu"))
end if
if request.form("zhongjin")<>"" then
rs("zhongjin")=trim(request.form("zhongjin"))
end if
if request.form("zhongyi")<>"" then
rs("zhongyi")=trim(request.form("zhongyi"))
end if
if request.form("zhonger")<>"" then
rs("zhonger")=trim(request.form("zhonger"))
end if
if request.form("zhongsan")<>"" then
rs("zhongsan")=trim(request.form("zhongsan"))
end if
if request.form("zhongsi")<>"" then
rs("zhongsi")=trim(request.form("zhongsi"))
end if
if request.form("zhongwu")<>"" then
rs("zhongwu")=trim(request.form("zhongwu"))
end if
if request.form("zhongliu")<>"" then
rs("zhongliu")=trim(request.form("zhongliu"))
end if
if request.form("hongqiu")<>"" then
rs("hongqiu")=trim(request.form("hongqiu"))
end if
if request.form("lanqiu")<>"" then
rs("lanqiu")=trim(request.form("lanqiu"))
end if
if request.form("tebie")<>"" then
rs("tebie")=trim(request.form("tebie"))
end if
if request.form("riqi")<>"" then
rs("riqi")=trim(request.form("riqi"))
end if
rs.update
bianhao=rs("bianhao")
end sub
sub editsoft()
sql="select * from caipiao where bianhao="&request("id")
rs.open sql,conn,1,3
rs("qihao")=qihao
if request.form("qita")<>"" then
rs("qita")=trim(request.form("qita"))
end if
if request.form("maizhu")<>"" then
rs("maizhu")=trim(request.form("maizhu"))
end if
if request.form("maijin")<>"" then
rs("maijin")=trim(request.form("maijin"))
end if
if request.form("zhongzhu")<>"" then
rs("zhongzhu")=trim(request.form("zhongzhu"))
end if
if request.form("zhongjin")<>"" then
rs("zhongjin")=trim(request.form("zhongjin"))
end if
if request.form("zhongyi")<>"" then
rs("zhongyiu")=trim(request.form("zhongyi"))
end if
if request.form("zhonger")<>"" then
rs("zhonger")=trim(request.form("zhonger"))
end if
if request.form("zhongsan")<>"" then
rs("zhongsan")=trim(request.form("zhongsan"))
end if
if request.form("zhongsi")<>"" then
rs("zhongsi")=trim(request.form("zhongsi"))
end if
if request.form("zhongwu")<>"" then
rs("zhongwu")=trim(request.form("zhongwu"))
end if
if request.form("zhongliu")<>"" then
rs("zhongliu")=trim(request.form("zhongliu"))
end if
if request.form("hongqiu")<>"" then
rs("hongqiu")=trim(request.form("hongqiu"))
end if
if request.form("lanqiu")<>"" then
rs("lanqiu")=trim(request.form("lanqiu"))
end if
if request.form("tebie")<>"" then
rs("tebie")=trim(request.form("tebie"))
end if
if request.form("riqi")<>"" then
rs("riqi")=trim(request.form("riqi"))
end if
rs.update
bianhao=rs("bianhao")
end sub

rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<html>

<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>
<div align="center"><center>
<br><br>
<table class="border" align=center width="50%" border="0" cellpadding="4" cellspacing="0" bordercolor="#999999">
<tr align=center>
<td width="100%" class="title" height="20"><b>
<%if request("action")="add" then%>添加<%else%>修改<%end if%>记录成功</b></td>
</tr>
<tr>
<td class="tdbg"><p align="left"><br>
本期编号为:<%response.write bianhao%><br>
本期期号为:<%response.write qihao%></p>
您可以进行其他操作
</td>
</tr>
</table>
</center></div>
<%
else
Error()
end if
%>

</body>
</html>
<%
sub Error()
response.write " <html><head><link rel='stylesheet' href='style.css'></head><body>"
response.write " <br><br><br>"
response.write " <table align='center' width='300' border='0' cellpadding='4' cellspacing='0' class='border'>"
response.write " <tr > "
response.write " <td class='title' colspan='2' height='15'> "
response.write " <div align='center'>由于以下的原因不能保存数据!</div>"
response.write " </td>"
response.write " </tr>"
response.write " <tr> "
response.write " <td align=center class='tdbg' colspan='2' height='23'> "
response.write " <br>"
response.write errmsg& " <br><br>"
response.write " <a href='javascript:onclick=history.go(-1)'>返回</a>"
response.write " <br><br></td>"
response.write " </tr> </table></body></html>"
end sub
%>

搜索更多相关主题的帖子: sql include lanqiu admin file 
2006-10-23 20:25
siulem
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-10-23
收藏
得分:0 
我一点也不会ASP,这是看到别人的程序加自己的数据库改的,添加的时候可以写入数据库,修改的时候就不行了.提示是

ADODB.Recordset (0x800A0E78)
对象关闭时,不允许操作
/caipiao/baocun.asp, 第 157 行

我把

rs.close
set rs=nothing

去掉也不行
2006-10-23 20:28
快速回复:[求助]能添加但不能修改
数据加载中...
 
   



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

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