Advertisement

08.24.2007 at 05:29PM PDT, ID: 22786279
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

Can't update a record with Dreamweaver CS3

Asked by Pantyboy in Macromedia Dreamweaver

Tags: , , , ,

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("CategoryID").Value %>" />

The source of the page is:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/RedShift.asp" -->
<%
Dim MM_editAction
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
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.ActiveConnection = MM_RedShift_STRING
    MM_editCmd.CommandText = "UPDATE tblCategories SET Category = ? WHERE CategoryID = ?"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("Category")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.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_editRedirectUrl)
  End If
End If
%>
<%
Dim rsStories
Dim rsStories_cmd
Dim rsStories_numRows

Set rsStories_cmd = Server.CreateObject ("ADODB.Command")
rsStories_cmd.ActiveConnection = 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.ActiveConnection = MM_RedShift_STRING
rsIntros_cmd.CommandText = "SELECT tblPageIntroductions.IntroductionID, tblCategories.Category, tblCategories.CategoryID, tblPageIntroductions.Introduction FROM tblCategories INNER JOIN tblPageIntroductions ON tblCategories.CategoryID = tblPageIntroductions.CategoryID 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.ActiveConnection = 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.js"></script>
</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>Update Item Menu</span></div>
        <a href="updateItem.asp?updateStory=True">Update Stories, etc.</a> <br />
        <a href="updateItem.asp?updateCategory=True">Update Categories</a> <br>
        <a href="updateItem.asp?updateIntro=True">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("updateStory") <> "") Then %>
           <div id="pageContentHeader"><span>Update Stories, etc.</span></div>
        <% ElseIf (Request.QueryString("updateCategory") <> "") Then %>
            <div id="pageContentHeader"><span>Rename Categories</span></div>
            <% ElseIf (Request.QueryString("updateIntro") <> "") Then %>
            <div id="pageContentHeader"><span>Update Page Introductions</span></div>
        <% Else %>
      <div id="pageContentHeader"><span>Update Item</span></div>
        <% End If %>
      <!-- End Section -->

<!-- Update a story/article/etc. form -->
<% If (Request.QueryString("updateStory") <> "") Then %>
<table width="100%">
  <%
While ((RepeatStories__numRows <> 0) AND (NOT rsStories.EOF))
%>
    <tr>
      <td bgcolor="#E7E7E7"><%=(rsStories.Fields.Item("Title").Value)%></td>
      <td width="25%" align="center" bgcolor="#E7E7E7"><form id="UpdateListForm" method="post" action="updateItemDetail.asp?StoryID=<%=(rsStories.Fields.Item("StoryID").Value)%>">
        <input name="SubmitStories" type="submit" class="formButton" id="SubmitStories" title="Update <%=(rsStories.Fields.Item("Title").Value)%>" value="Update" />
      </form></td>
    </tr>
    <%
  RepeatStories__index=RepeatStories__index+1
  RepeatStories__numRows=RepeatStories__numRows-1
  rsStories.MoveNext()
Wend
%>
</table>
<!-- End of story/article/etc. form -->

<!-- Update a category -->
<% ElseIf (Request.QueryString("updateCategory") <> "") Then %>
<form name="UpdateCategoryForm" id="UpdateCategoryForm" method="POST" action="<%=MM_editAction%>">
  <table width="100%">
    <%
While ((RepeatCategories__numRows <> 0) AND (NOT rsCategory.EOF))
%>
      <tr>
        <td width="25%" bgcolor="#E7E7E7"><%=(rsCategory.Fields.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=RepeatCategories__index+1
  RepeatCategories__numRows=RepeatCategories__numRows-1
  rsCategory.MoveNext()
Wend
%>
  </table>

  <input type="hidden" name="MM_update" value="UpdateCategoryForm" />
  <input type="hidden" name="MM_recordId" value="<%= rsCategory.Fields.Item("CategoryID").Value %>" />
</form>
<!-- End of Category -->


<!-- Update page introductions -->
<% ElseIf (Request.QueryString("updateIntro") <> "") Then %>
<table width="100%">
  <%
While ((RepeatIntros__numRows <> 0) AND (NOT rsIntros.EOF))
%>
    <tr>
      <td bgcolor="#E7E7E7"><%=(rsIntros.Fields.Item("Category").Value)%> 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=RepeatIntros__index+1
  RepeatIntros__numRows=RepeatIntros__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">&nbsp;</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

MartinStart Free Trial
[+][-]08.24.2007 at 06:58PM PDT, ID: 19766528

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.24.2007 at 06:59PM PDT, ID: 19766531

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.24.2007 at 08:15PM PDT, ID: 19766661

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.25.2007 at 08:29AM PDT, ID: 19768170

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.27.2007 at 04:29PM PDT, ID: 19779365

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Macromedia Dreamweaver
Tags: current, eof, been, cs3, record
Sign Up Now!
Solution Provided By: Pantyboy
Participating Experts: 3
Solution Grade: B
 
 
[+][-]01.03.2008 at 06:23PM PST, ID: 20579317

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628