| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1588 人关注过本帖
标题:表单更新记录出错
只看楼主 加入收藏
wutao198419
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-10-23
收藏
得分:0 
错误类型:
ADODB.Field (0x800A0BCD)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/psbsh1.asp, 第 495 行


<tr>
<td height="60" colspan="19" nowrap="nowrap" bgcolor="#9cd7ff"><label>
<div align="center">
<input name="Submit" type="submit" class="STYLE1" value="审 核 通 过" />
</div>
</label></td>
</tr>
</table>




<input type="hidden" name="MM_update" value="form7">
<input type="hidden" name="MM_recordId" value="<%= qjsb.Fields.Item("id").Value %>"> /////这是495行
</form>
</tr>
</body>
</html>
<%
qjsb.Close()
Set qjsb = Nothing
%>


不好意思不好意思
2006-10-25 10:16
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
<input type="hidden" name="MM_recordId" value="<%= qjsb.Fields.Item("id").Value %>">

这的 <%= qjsb.Fields.Item("id").Value %> 是什么值?

http://www./
2006-10-25 10:18
wutao198419
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-10-23
收藏
得分:0 
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/xitongdenglu.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) = "form7" And CStr(Request("MM_recordId")) <> "") Then

MM_editConnection = MM_xitongdenglu_STRING
MM_editTable = "区局申报"
MM_editColumn = "id"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "psbshcg.asp"
MM_fieldsStr = "sbbm|value|bzrq|value|khmc|value|khdh|value|jydz|value|jyqy|value|fplx|value|bdzjsyy|value|zmzh|value|bzrq|value|qjbz|value|psbsh|value|psb|value|psy|value|xqjps|value|dsdzh|value|psclsj|value|psbz|value"
MM_columnsStr = "sbbm|',none,''|sbrq|',none,''|khmc|',none,''|khdh|',none,''|jydz|',none,''|jyqy|',none,''|fplx|',none,''|bdzjsyy|',none,''|zmzh|',none,''|bzrq|',none,''|qjbz|',none,''|psbsh|',none,''|psb|',none,''|psy|',none,''|xqjps|',none,''|dsdzh|',none,''|psclsj|',none,''|psbz|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
Dim qjsb
Dim qjsb_numRows

Set qjsb = Server.CreateObject("ADODB.Recordset")
qjsb.ActiveConnection = MM_xitongdenglu_STRING
qjsb.Source = "SELECT * FROM 区局申报 WHERE sbrq='"&request("sbrq")&"'"
qjsb.CursorType = 0
qjsb.CursorLocation = 2
qjsb.LockType = 1
qjsb.Open()

qjsb_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
qjsb_numRows = qjsb_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (rs_total = -1) Then

' count the total records by iterating through the recordset
rs_total=0
While (Not rs.EOF)
rs_total = rs_total + 1
rs.MoveNext
Wend

' reset the cursor to the beginning
If (rs.CursorType > 0) Then
rs.MoveFirst
Else
rs.Requery
End If

' set the number of rows displayed on this page
If (rs_numRows < 0 Or rs_numRows > rs_total) Then
rs_numRows = rs_total
End If

' set the first and last displayed record
rs_first = 1
rs_last = rs_first + rs_numRows - 1

If (rs_first > rs_total) Then
rs_first = rs_total
End If
If (rs_last > rs_total) Then
rs_last = rs_total
End If

End If
%>
<!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>
<link href="table.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {
font-size: xx-large;
font-weight: bold;
}
.STYLE2 {
font-size: x-large;
font-weight: bold;
}
-->
</style>
</head>

<body>
<tr>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form7" id="form7">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#006600">
<tr>
<td height="50" colspan="19" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center"><span class="STYLE1">配 送 部 审 核</span></div></td>
</tr>

<tr>
<td height="40" colspan="2" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">申报部门</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">申报日期</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">客户名称</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">客户电话</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">经营地址</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">经营区域</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">发票类型</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">不实行电子结算原因</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">专卖证号</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">办证日期</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">区局备注</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">确认审核</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">配送部</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">配送员</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">星期几配送</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">代送点证号</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">配送处理时间</div></td>
<td height="40" nowrap="NOWRAP" bgcolor="#9cd7ff"><div align="center">配送备注</div></td>
</tr>
<tr>
<td></td>
</tr>


<%
While ((Repeat1__numRows <> 0) AND (NOT qjsb.EOF))
%>
<tr>
<td height="50" colspan="2" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="sbbm" type="text" id="sbbm" value="<%=(qjsb.Fields.Item("sbbm").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="bzrq" type="text" id="bzrq" value="<%=(qjsb.Fields.Item("sbrq").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="khmc" type="text" id="khmc" value="<%=(qjsb.Fields.Item("khmc").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="khdh" type="text" id="khdh" value="<%=(qjsb.Fields.Item("khdh").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="jydz" type="text" id="jydz" value="<%=(qjsb.Fields.Item("jydz").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="jyqy" type="text" id="jyqy" value="<%=(qjsb.Fields.Item("jyqy").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="fplx" type="text" id="fplx" value="<%=(qjsb.Fields.Item("fplx").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="bdzjsyy" type="text" id="bdzjsyy" value="<%=(qjsb.Fields.Item("bdzjsyy").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="zmzh" type="text" id="zmzh" value="<%=(qjsb.Fields.Item("zmzh").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="bzrq" type="text" id="bzrq" value="<%=(qjsb.Fields.Item("bzrq").Value)%>" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="qjbz" type="text" id="qjbz" value="<%=(qjsb.Fields.Item("qjbz").Value)%>" />
</label></td>
<td nowrap="nowrap" bgcolor="#ffcccc"><label>
<select name="psbsh" id="psbsh">
<option value="butongguo" selected="selected">不审核</option>
<option value="tongguo">审核通过</option>
</select>
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<select name="psb" id="psb">
<option selected="selected">请选择</option>
<option>配送一部</option>
<option>配送二部</option>
<option>配送三部</option>
</select>
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<select name="psy" id="psy">
<option selected="selected">请选择</option>
<option>市区1-01</option>
<option>市区1-02</option>
<option>市区1-03</option>
<option>市区1-04</option>
<option>市区1-05</option>
<option>市区1-06</option>
<option>市区1-07</option>
<option>市区1-08</option>
<option>市区1-09</option>
<option>市区1-10</option>
<option>市区1-11</option>
<option>市区1-12</option>
<option>市区1-13</option>
<option>市区1-14</option>
<option>市区1-15</option>
<option>市区1-16</option>
<option>市区1-17</option>
<option>市区1-18</option>
<option>市区1-19</option>
<option>市区1-20</option>
<option>市区1-21</option>
<option>市区1-22</option>
<option>市区1-23</option>
<option>市区1-24</option>
<option>市区1-25</option>
<option>市区1-26</option>
<option>市区1-27</option>
<option>市区1-28</option>
<option>市区1-29</option>
<option>市区2-01</option>
<option>市区2-02</option>
<option>市区2-03</option>
<option>市区2-04</option>
<option>市区2-05</option>
<option>市区2-06</option>
<option>市区2-07</option>
<option>市区2-08</option>
<option>市区2-09</option>
<option>市区2-10</option>
<option>市区2-11</option>
<option>市区2-12</option>
<option>市区2-13</option>
<option>市区2-14</option>
<option>市区2-15</option>
<option>市区2-16</option>
<option>市区2-17</option>
<option>市区2-18</option>
<option>市区2-19</option>
<option>市区2-20</option>
<option>市区2-21</option>
<option>市区2-22</option>
<option>市区2-23</option>
<option>市区2-24</option>
<option>市区2-25</option>
<option>市区2-26</option>
<option>市区2-27</option>
<option>市区3-01</option>
<option>市区3-02</option>
<option>市区3-03</option>
<option>市区3-04</option>
<option>市区3-05</option>
<option>市区3-06</option>
<option>市区3-07</option>
<option>市区3-08</option>
<option>市区3-09</option>
<option>市区3-10</option>
<option>市区3-11</option>
<option>市区3-12</option>
<option>市区3-13</option>
<option>市区3-14</option>
<option>市区3-15</option>
<option>市区3-16</option>
<option>市区3-17</option>
<option>市区3-18</option>
<option>市区3-19</option>
<option>市区3-20</option>
<option>市区3-21</option>
<option>市区3-23</option>
<option>市区3-24</option>
<option>市区3-25</option>
<option>市区3-26</option>
<option>市区3-27</option>
<option>市区3-28</option>
<option>市区3-29</option>
<option>市区3-30</option>
<option>市区3-31</option>
<option>市区3-32</option>
<option>市区3-33</option>
<option>市区3-34</option>
<option>市区3-35</option>
<option>市区3-36</option>
<option>市区3-37</option>
<option>市区3-38</option>
<option>市区3-39</option>
<option>市区3-40</option>
<option>市区3-41</option>
<option>市区3-42</option>
<option>市区3-43</option>
<option>市区3-44</option>
<option>市区3-45</option>
<option>市区3-46</option>
</select>
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<select name="xqjps" id="xqjps">
<option selected="selected">请选择</option>
<option>周一</option>
<option>周二</option>
<option>周三</option>
<option>周四</option>
<option>周五</option>
<option>周六</option>
<option>周日</option>
</select>
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="dsdzh" type="text" id="dsdzh" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="psclsj" type="text" id="psclsj" value="<% = Date%>" size="12" />
</label></td>
<td height="50" nowrap="nowrap" bgcolor="#ffcccc"><label>
<input name="psbz" type="text" id="psbz" size="25" />
</label></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
qjsb.MoveNext()
Wend
%>

这些是出错的那个页面的其他代码
2006-10-25 10:19
wutao198419
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-10-23
收藏
得分:0 
就是更新的时候可以选择一个唯一键列   我这里指定的是ID这个建列  可以更新操作的那个ID的那条记录
2006-10-25 10:21
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
但是你这个是放在循环的外面了,怎么取值?

http://www./
2006-10-25 10:33
jimmy_wang
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2006-10-10
收藏
得分:0 
while .....

qjsb.movenext
wend

跳出循环后,说明当前的记录不存在了,
怎么可能还有"<%= qjsb.Fields.Item("id").Value %>"这个呢?

加上qjsb.moveprevious这句那就没问题了
2006-10-25 10:39
wutao198419
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-10-23
收藏
得分:0 
谢谢你啊 我把2行放到循环里面去了 居然成功了哈哈  谢谢你啊
2006-10-25 10:42
快速回复:表单更新记录出错
数据加载中...
 
   



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

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