Hi Experts.
I'm trying to update a record using the built in behaviour in DW CS3 but I get the error:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation
requires a current record.
The line it points to is:
<input type="hidden" name="MM_recordId" value="<%= rsCategory.Fields.Item("Ca
tegoryID")
.Value %>" />
The source of the page is:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/RedSh
ift.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariabl
es("SCRIPT
_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.
QueryStrin
g)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_update")
) = "UpdateCategoryForm") Then
If (Not MM_abortEdit) Then
' execute the update
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnectio
n = MM_RedShift_STRING
MM_editCmd.CommandText = "UPDATE tblCategories SET Category = ? WHERE CategoryID = ?"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Appe
nd MM_editCmd.CreateParameter
("param1",
202, 1, 255, Request.Form("Category")) ' adVarWChar
MM_editCmd.Parameters.Appe
nd MM_editCmd.CreateParameter
("param2",
5, 1, -1, MM_IIF(Request.Form("MM_re
cordId"), Request.Form("MM_recordId"
), null)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnectio
n.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "updateItemSuccessful.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editR
edirectUrl
)
End If
End If
%>
<%
Dim rsStories
Dim rsStories_cmd
Dim rsStories_numRows
Set rsStories_cmd = Server.CreateObject ("ADODB.Command")
rsStories_cmd.ActiveConnec
tion = MM_RedShift_STRING
rsStories_cmd.CommandText = "SELECT Author, CategoryID, Menu_Item, Story, StoryID, Title FROM tblStories ORDER BY Title ASC"
rsStories_cmd.Prepared = true
Set rsStories = rsStories_cmd.Execute
rsStories_numRows = 0
%>
<%
Dim rsIntros
Dim rsIntros_cmd
Dim rsIntros_numRows
Set rsIntros_cmd = Server.CreateObject ("ADODB.Command")
rsIntros_cmd.ActiveConnect
ion = MM_RedShift_STRING
rsIntros_cmd.CommandText = "SELECT tblPageIntroductions.Intro
ductionID,
tblCategories.Category, tblCategories.CategoryID, tblPageIntroductions.Intro
duction FROM tblCategories INNER JOIN tblPageIntroductions ON tblCategories.CategoryID = tblPageIntroductions.Categ
oryID ORDER BY tblCategories.Category ASC"
rsIntros_cmd.Prepared = true
Set rsIntros = rsIntros_cmd.Execute
rsIntros_numRows = 0
%>
<%
Dim rsCategory
Dim rsCategory_cmd
Dim rsCategory_numRows
Set rsCategory_cmd = Server.CreateObject ("ADODB.Command")
rsCategory_cmd.ActiveConne
ction = MM_RedShift_STRING
rsCategory_cmd.CommandText
= "SELECT * FROM tblCategories WHERE CategoryID > 2"
rsCategory_cmd.Prepared = true
Set rsCategory = rsCategory_cmd.Execute
rsCategory_numRows = 0
%>
<%
Dim RepeatStories__numRows
Dim RepeatStories__index
RepeatStories__numRows = -1
RepeatStories__index = 0
rsStories_numRows = rsStories_numRows + RepeatStories__numRows
%>
<%
Dim RepeatIntros__numRows
Dim RepeatIntros__index
RepeatIntros__numRows = -1
RepeatIntros__index = 0
rsIntros_numRows = rsIntros_numRows + RepeatIntros__numRows
%>
<%
Dim RepeatCategories__numRows
Dim RepeatCategories__index
RepeatCategories__numRows = -1
RepeatCategories__index = 0
rsCategory_numRows = rsCategory_numRows + RepeatCategories__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Redshift Online - Site Administration</title>
<link href="../Scripts/redshift.
css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="../Scripts/redshift.j
s"></scrip
t>
</head>
<body onload="equalize()">
<div id="container">
<!-- Top of the page -->
<div id="logo"><!--#include file="includes/Logo.asp" --></div>
<div id="navBar"><!--#include file="includes/navBar.asp"
--></div>
<!-- End top -->
<!-- Start of actual main content -->
<div id="contentWrapper">
<!-- Page Menu -->
<div id="sideBar">
<div id="menuHeader"><span>Upda
te Item Menu</span></div>
<a href="updateItem.asp?updat
eStory=Tru
e">Update Stories, etc.</a> <br />
<a href="updateItem.asp?updat
eCategory=
True">Upda
te Categories</a> <br>
<a href="updateItem.asp?updat
eIntro=Tru
e">Update Introductions</a> <br />
</div>
<!-- End Menu -->
<!-- Page Content -->
<div id="pageContent">
<!-- Alter Section Header to reflect which form is being used -->
<% If (Request.QueryString("upda
teStory") <> "") Then %>
<div id="pageContentHeader"><sp
an>Update Stories, etc.</span></div>
<% ElseIf (Request.QueryString("upda
teCategory
") <> "") Then %>
<div id="pageContentHeader"><sp
an>Rename Categories</span></div>
<% ElseIf (Request.QueryString("upda
teIntro") <> "") Then %>
<div id="pageContentHeader"><sp
an>Update Page Introductions</span></div>
<% Else %>
<div id="pageContentHeader"><sp
an>Update Item</span></div>
<% End If %>
<!-- End Section -->
<!-- Update a story/article/etc. form -->
<% If (Request.QueryString("upda
teStory") <> "") Then %>
<table width="100%">
<%
While ((RepeatStories__numRows <> 0) AND (NOT rsStories.EOF))
%>
<tr>
<td bgcolor="#E7E7E7"><%=(rsSt
ories.Fiel
ds.Item("T
itle").Val
ue)%></td>
<td width="25%" align="center" bgcolor="#E7E7E7"><form id="UpdateListForm" method="post" action="updateItemDetail.a
sp?StoryID
=<%=(rsSto
ries.Field
s.Item("St
oryID").Va
lue)%>">
<input name="SubmitStories" type="submit" class="formButton" id="SubmitStories" title="Update <%=(rsStories.Fields.Item(
"Title").V
alue)%>" value="Update" />
</form></td>
</tr>
<%
RepeatStories__index=Repea
tStories__
index+1
RepeatStories__numRows=Rep
eatStories
__numRows-
1
rsStories.MoveNext()
Wend
%>
</table>
<!-- End of story/article/etc. form -->
<!-- Update a category -->
<% ElseIf (Request.QueryString("upda
teCategory
") <> "") Then %>
<form name="UpdateCategoryForm" id="UpdateCategoryForm" method="POST" action="<%=MM_editAction%>
">
<table width="100%">
<%
While ((RepeatCategories__numRow
s <> 0) AND (NOT rsCategory.EOF))
%>
<tr>
<td width="25%" bgcolor="#E7E7E7"><%=(rsCa
tegory.Fie
lds.Item("
Category")
.Value)%><
/td>
<td align="center" bgcolor="#E7E7E7"><input name="Category" type="text" class="inputBox" id="Category" value="Enter the category's new name" /></td>
<td width="25%" align="center" bgcolor="#E7E7E7"><input name="SubmitCategory" type="submit" class="formButton" id="SubmitCategory" value="Update" /></td>
</tr>
<%
RepeatCategories__index=Re
peatCatego
ries__inde
x+1
RepeatCategories__numRows=
RepeatCate
gories__nu
mRows-1
rsCategory.MoveNext()
Wend
%>
</table>
<input type="hidden" name="MM_update" value="UpdateCategoryForm"
/>
<input type="hidden" name="MM_recordId" value="<%= rsCategory.Fields.Item("Ca
tegoryID")
.Value %>" />
</form>
<!-- End of Category -->
<!-- Update page introductions -->
<% ElseIf (Request.QueryString("upda
teIntro") <> "") Then %>
<table width="100%">
<%
While ((RepeatIntros__numRows <> 0) AND (NOT rsIntros.EOF))
%>
<tr>
<td bgcolor="#E7E7E7"><%=(rsIn
tros.Field
s.Item("Ca
tegory").V
alue)%> Page</td>
<td width="25%" align="center" bgcolor="#E7E7E7"><form id="UpdateIntrosForm" method="post" action="">
<input name="SubmitIntros" type="submit" class="formButton" id="SubmitIntros" title="Update <%=(rsIntros.Fields.Item("
Category")
.Value)%> Page" value="Update" />
</form></td>
</tr>
<%
RepeatIntros__index=Repeat
Intros__in
dex+1
RepeatIntros__numRows=Repe
atIntros__
numRows-1
rsIntros.MoveNext()
Wend
%>
</table>
<!-- End page intros update -->
<% Else %>
Use the menu on the side to update existing stories/articles etc, categories and page introductions.<p></p>
<% End If %>
</div>
<!-- End Page Content -->
<!-- Page Footer -->
<div id="footer"> </div>
<!-- End Footer -->
<!-- End of actual main Content -->
</div>
</div>
</body>
</html>
<%
rsStories.Close()
Set rsStories = Nothing
%>
<%
rsCategory.Close()
Set rsCategory = Nothing
%>
<%
rsIntros.Close()
Set rsIntros = Nothing
%>
I have a rotten feeling it's because I have more that one form on the page. If that's so how can I get the update to work? If not, what's wrong?
Regards
Martin
Start Free Trial