asp修改记录
asp代码如下:<!--#includefile=../../conn.asp--><%ifrequest("action")="editsave"thensetrs=S...
asp代码如下:
<!--#include file=../../conn.asp-->
<%
if request("action")="editsave" then
set rs=Server.CreateObject("ADODB.RecordSet")
spid=replace(trim(request.Form("spid")),"'","")
spname=replace(trim(request.Form("spname")),"'","")
spxh=replace(trim(request.Form("spxh")),"'","")
splx=replace(trim(request.Form("splx")),"'","")
sccj=replace(trim(request.Form("sccj")),"'","")
spphone=replace(trim(request.Form("spphone")),"'","")
spaddress=replace(trim(request.Form("spaddress")),"'","")
text=replace(trim(request.Form("text")),"'","")
sql="select * from spxx where spid='"&spid&"'"
rs.open Sql,conn,3,2
rs("spname")=spname
rs("spxh")=spxh
rs("splx")=splx
rs("sccj")=sccj
rs("spaddress")=spaddress
rs("spphone")=spphone
rs("text")=text
rs.update
rs.close
set rs=nothing
response.Write("<script language='javascript'>alert('修改成功!');history.go(-1);</script>")
response.end
end if
%>
<%
spid=trim(request.Form("spid"))
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from spxx where spid="&request("spid")&""
rs.open sql,conn,1,3
%>
</span> <div id="Layer2">
<form name="form1" method="post" action="?action=editsave">
<table width="427" height="408" border="0">
<td height="41" colspan="3"><span class="STYLE8">信息详情
<td height="25">单号:</td>
<td height="25" colspan="2"><span class="STYLE15"><%=rs("spid") %></span></td>
<td width="123" height="25">商品名称:</td>
<td height="25" colspan="2"><label>
<input name="spname" type="text" id="spname" value="<%=rs("spname")%>">
</label></td>
</tr>
<tr>
<td height="25">商品型号:</td>
<td height="25" colspan="2"><label>
<input name="spxh" type="text" id="spxh" value="<%=rs("spxh")%>">
</label></td>
</tr>
<tr>
<td height="25">商品类型:</td>
<td height="25" colspan="2"><label>
<input name="splx" type="text" id="splx" value="<%=rs("splx")%>">
</label></td>
</tr>
<tr>
<td height="25">生产厂家:</td>
<td height="25" colspan="2"><label>
<input name="sccj" type="text" id="sccj" value="<%=rs("sccj")%>">
</label></td>
</tr>
<tr>
<td height="25">厂家地址:</td>
<td height="25" colspan="2"><label>
<input name="spaddress" type="text" id="spaddress" value="<%=rs("spaddress")%>">
<input type="submit" name="Submit" value="修改">
================================================
错误提示:ADODB.Recordset '800a0bcd'
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
\www\xtsz\spxx\views.asp, line 169
169行就是 rs("spname")=spname 这行
实在弄不好了,高手帮看看怎么回事啊~~~ 展开
<!--#include file=../../conn.asp-->
<%
if request("action")="editsave" then
set rs=Server.CreateObject("ADODB.RecordSet")
spid=replace(trim(request.Form("spid")),"'","")
spname=replace(trim(request.Form("spname")),"'","")
spxh=replace(trim(request.Form("spxh")),"'","")
splx=replace(trim(request.Form("splx")),"'","")
sccj=replace(trim(request.Form("sccj")),"'","")
spphone=replace(trim(request.Form("spphone")),"'","")
spaddress=replace(trim(request.Form("spaddress")),"'","")
text=replace(trim(request.Form("text")),"'","")
sql="select * from spxx where spid='"&spid&"'"
rs.open Sql,conn,3,2
rs("spname")=spname
rs("spxh")=spxh
rs("splx")=splx
rs("sccj")=sccj
rs("spaddress")=spaddress
rs("spphone")=spphone
rs("text")=text
rs.update
rs.close
set rs=nothing
response.Write("<script language='javascript'>alert('修改成功!');history.go(-1);</script>")
response.end
end if
%>
<%
spid=trim(request.Form("spid"))
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from spxx where spid="&request("spid")&""
rs.open sql,conn,1,3
%>
</span> <div id="Layer2">
<form name="form1" method="post" action="?action=editsave">
<table width="427" height="408" border="0">
<td height="41" colspan="3"><span class="STYLE8">信息详情
<td height="25">单号:</td>
<td height="25" colspan="2"><span class="STYLE15"><%=rs("spid") %></span></td>
<td width="123" height="25">商品名称:</td>
<td height="25" colspan="2"><label>
<input name="spname" type="text" id="spname" value="<%=rs("spname")%>">
</label></td>
</tr>
<tr>
<td height="25">商品型号:</td>
<td height="25" colspan="2"><label>
<input name="spxh" type="text" id="spxh" value="<%=rs("spxh")%>">
</label></td>
</tr>
<tr>
<td height="25">商品类型:</td>
<td height="25" colspan="2"><label>
<input name="splx" type="text" id="splx" value="<%=rs("splx")%>">
</label></td>
</tr>
<tr>
<td height="25">生产厂家:</td>
<td height="25" colspan="2"><label>
<input name="sccj" type="text" id="sccj" value="<%=rs("sccj")%>">
</label></td>
</tr>
<tr>
<td height="25">厂家地址:</td>
<td height="25" colspan="2"><label>
<input name="spaddress" type="text" id="spaddress" value="<%=rs("spaddress")%>">
<input type="submit" name="Submit" value="修改">
================================================
错误提示:ADODB.Recordset '800a0bcd'
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
\www\xtsz\spxx\views.asp, line 169
169行就是 rs("spname")=spname 这行
实在弄不好了,高手帮看看怎么回事啊~~~ 展开
2个回答
展开全部
form表单中没有spid,也就是说,spid没有被提交
所以,spid=replace(trim(request.Form("spid")),"'","")这句执行之后,spid为空,
接下来程序到这,sql="select * from spxx where spid='"&spid&"'"
where条件为spid='',查询结果当然是BOF 或 EOF
---------------------------------
解决方案:
在form表单中,写成这样,
单号:<input type="hidden" name="spid" value="<%=rs("spid")%>">
所以,spid=replace(trim(request.Form("spid")),"'","")这句执行之后,spid为空,
接下来程序到这,sql="select * from spxx where spid='"&spid&"'"
where条件为spid='',查询结果当然是BOF 或 EOF
---------------------------------
解决方案:
在form表单中,写成这样,
单号:<input type="hidden" name="spid" value="<%=rs("spid")%>">
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询