SQL error 80040e14 Could not find prepared statement with handle -1

jedtheguru
jedtheguru used Ask the Experts™
on
Hi,
I have the following error when trying to connect to an admin page that updates a database.  This worked fine for a while and then started to become intermittent to now where it rarely loads.  If you push refresh enough times the page will eventually load.  I though there might be a table issue so I rebuilt the table and it seemed to improve for a while.

Microsoft OLE DB Provider for SQL Server error '80040e14'

Could not find prepared statement with handle -1.

/adminmtt/updatenews.asp, line 284

There are only 17 records in the database so far so not a big database.  The page is built in Dreamweaver CS4. I have included the complete code for the page as well as screen shot showign line number mentioned in the error

Any help would be appreciated
Cheers Geoff
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
'**************************
'  WYSIWYG HTML Editor
'  http://www.DwZone.it
'  Version: 2.0.2
'**************************
' Declare variables
Dim sBasePath, oFCKeditor
%>
<!--#include file="../Connections/dboMTT_cs.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")) = "fmNewNews") Then
  If (Not MM_abortEdit) Then
    ' execute the update
    Dim MM_editCmd
 
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_dboMTT_cs_STRING
    MM_editCmd.CommandText = "UPDATE dbo.mainnews SET anchorid = ?, menulink = ?, heading = ?, newsdate = ?, newsyear = ?, contentmain = ?, photolink = ?, photocaption = ?, photocredit = ?, currentnews = ?, archivenews = ?, progresssofar = ?, menuselect = ? WHERE idnews = ?" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, -1, Request.Form("anchorid")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, -1, Request.Form("menulink")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, -1, Request.Form("heading")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 135, 1, -1, MM_IIF(Request.Form("newsdate"), Request.Form("newsdate"), null)) ' adDBTimeStamp
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 5, 1, -1, MM_IIF(Request.Form("newsyear"), Request.Form("newsyear"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 201, 1, -1, Request.Form("contentmain")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 201, 1, -1, Request.Form("photolink")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 201, 1, -1, Request.Form("photocaption")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 201, 1, -1, Request.Form("photocredit")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 5, 1, -1, MM_IIF(Request.Form("currentnews"), Request.Form("currentnews"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 5, 1, -1, MM_IIF(Request.Form("archivenews"), Request.Form("archivenews"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 5, 1, -1, MM_IIF(Request.Form("progresssofar"), Request.Form("progresssofar"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param13", 5, 1, -1, MM_IIF(Request.Form("menuselect"), Request.Form("menuselect"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param14", 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 = "updatenews.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
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim rsCommon__MMColParam
rsCommon__MMColParam = "2"
If (Request("MM_EmptyValue") <> "") Then 
  rsCommon__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsCommon
Dim rsCommon_cmd
Dim rsCommon_numRows
 
Set rsCommon_cmd = Server.CreateObject ("ADODB.Command")
rsCommon_cmd.ActiveConnection = MM_dboMTT_cs_STRING
rsCommon_cmd.CommandText = "SELECT menuarrow FROM dbo.commonitems WHERE idcommon = ?" 
rsCommon_cmd.Prepared = true
rsCommon_cmd.Parameters.Append rsCommon_cmd.CreateParameter("param1", 5, 1, -1, rsCommon__MMColParam) ' adDouble
 
Set rsCommon = rsCommon_cmd.Execute
rsCommon_numRows = 0
%>
<%
Dim rsPages
Dim rsPages_cmd
Dim rsPages_numRows
 
Set rsPages_cmd = Server.CreateObject ("ADODB.Command")
rsPages_cmd.ActiveConnection = MM_dboMTT_cs_STRING
rsPages_cmd.CommandText = "SELECT * FROM dbo.adminpages ORDER BY menuorder ASC" 
rsPages_cmd.Prepared = true
 
Set rsPages = rsPages_cmd.Execute
rsPages_numRows = 0
%>
<%
Dim rsnewnews
Dim rsnewnews_cmd
Dim rsnewnews_numRows
 
Set rsnewnews_cmd = Server.CreateObject ("ADODB.Command")
rsnewnews_cmd.ActiveConnection = MM_dboMTT_cs_STRING
rsnewnews_cmd.CommandText = "SELECT * FROM dbo.mainnews ORDER BY newsdate DESC" 
rsnewnews_cmd.Prepared = true
 
Set rsnewnews = rsnewnews_cmd.Execute
rsnewnews_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
 
Repeat1__numRows = -1
Repeat1__index = 0
rsPages_numRows = rsPages_numRows + Repeat1__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
 
Dim rsnewnews_total
Dim rsnewnews_first
Dim rsnewnews_last
 
' set the record count
rsnewnews_total = rsnewnews.RecordCount
 
' set the number of rows displayed on this page
If (rsnewnews_numRows < 0) Then
  rsnewnews_numRows = rsnewnews_total
Elseif (rsnewnews_numRows = 0) Then
  rsnewnews_numRows = 1
End If
 
' set the first and last displayed record
rsnewnews_first = 1
rsnewnews_last  = rsnewnews_first + rsnewnews_numRows - 1
 
' if we have the correct record count, check the other stats
If (rsnewnews_total <> -1) Then
  If (rsnewnews_first > rsnewnews_total) Then
    rsnewnews_first = rsnewnews_total
  End If
  If (rsnewnews_last > rsnewnews_total) Then
    rsnewnews_last = rsnewnews_total
  End If
  If (rsnewnews_numRows > rsnewnews_total) Then
    rsnewnews_numRows = rsnewnews_total
  End If
End If
%>
<%
Dim MM_paramName 
%>
<%
' *** Move To Record and Go To Record: declare variables
 
Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined
 
Dim MM_param
Dim MM_index
 
Set MM_rs    = rsnewnews
MM_rsCount   = rsnewnews_total
MM_size      = rsnewnews_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
 
if (Not MM_paramIsDefined And MM_rsCount <> 0) then
 
  ' use index parameter if defined, otherwise use offset parameter
  MM_param = Request.QueryString("index")
  If (MM_param = "") Then
    MM_param = Request.QueryString("offset")
  End If
  If (MM_param <> "") Then
    MM_offset = Int(MM_param)
  End If
 
  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsCount <> -1) Then
    If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move last
      If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If
 
  ' move the cursor to the selected record
  MM_index = 0
  While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
  If (MM_rs.EOF) Then 
    MM_offset = MM_index  ' set MM_offset to the last possible record
  End If
 
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
 
If (MM_rsCount = -1) Then
 
  ' walk to the end of the display range for this page
  MM_index = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
 
  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = MM_index
    If (MM_size < 0 Or MM_size > MM_rsCount) Then
      MM_size = MM_rsCount
    End If
  End If
 
  ' if we walked off the end, set the offset based on page size
  If (MM_rs.EOF And Not MM_paramIsDefined) Then
    If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
      If ((MM_rsCount Mod MM_size) > 0) Then
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If
 
  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If
 
  ' move the cursor to the selected record
  MM_index = 0
  While (Not MM_rs.EOF And MM_index < MM_offset)
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats
 
' set the first and last displayed record
rsnewnews_first = MM_offset + 1
rsnewnews_last  = MM_offset + MM_size
 
If (MM_rsCount <> -1) Then
  If (rsnewnews_first > MM_rsCount) Then
    rsnewnews_first = MM_rsCount
  End If
  If (rsnewnews_last > MM_rsCount) Then
    rsnewnews_last = MM_rsCount
  End If
End If
 
' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** 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
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
 
Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev
 
Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam
 
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
 
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
  MM_moveParam = "offset"
  If (MM_keepMove <> "") Then
    MM_paramList = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For MM_paramIndex = 0 To UBound(MM_paramList)
      MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
      If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
        MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
      End If
    Next
    If (MM_keepMove <> "") Then
      MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
  End If
End If
 
' set the strings for the move to links
If (MM_keepMove <> "") Then 
  MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
End If
 
MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
 
MM_moveFirst = MM_urlStr & "0"
MM_moveLast  = MM_urlStr & "-1"
MM_moveNext  = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
  MM_movePrev = MM_urlStr & "0"
Else
  MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
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">
<script language="JavaScript" src="/FckEditor/UpdateValue.js" type="text/javascript"></script>
<!-- InstanceBegin template="/Templates/tp_adminpages_v1.dwt.asp" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>MEIT - Update News</title>
<!-- InstanceEndEditable -->
<link href="../css/txMain.css" rel="stylesheet" type="text/css" />
<link href="../css/loAdmin.css" rel="stylesheet" type="text/css" />
<style type="text/css" media="screen">
@import url("../buttons/fwMenuRecDir_v1.css");
@import url("../buttons/fwMenuEdu_v1.css");
@import url("../buttons/fwMenuMountainRest_v1.css");
@import url("../buttons/fwMenuMT_v1.css");
@import url("../buttons/fwMenuSupporters_v1.css");
@import url("../buttons/fwMenuProjectAim_v2.css");
@import url("../buttons/fwMenuRecDir_v2.css");
@import url("../buttons/fwMenuNews_v1.css");
</style>
<script language="JavaScript1.2" type="text/javascript" src="../buttons/mm_css_menu.js"></script>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
 
<body class="main">
<div class="main" id="container">
    <div class="main" id="menu">
      <table border="0">
        <tr>
          <td><a href="../index.asp"><img name="fwMenuHome_v1" src="../buttons/fwMenuHome_v1.png" width="190" height="34" border="0" id="fwMenuHome_v1" alt="" /></a></td>
        </tr>
        <tr>
          <td><div id="FWTableContainer2041234538"> <a href="javascript:;" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuShowMenu('MMMenuContainer0422215357_0', 'MMMenu0422215357_0',190,0,'fwMenuNews_v1');"><img name="fwMenuNews_v1" src="../buttons/fwMenuNews_v1.png" width="190" height="34" border="0" id="fwMenuNews_v1" alt="" /></a>
            <div id="MMMenuContainer0422215357_0">
              <div id="MMMenu0422215357_0" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuResetTimeout();"> <a href="../subpages/news/news.asp" id="MMMenu0422215357_0_Item_0" class="MMMIFVStyleMMMenu0422215357_0" onmouseover="MM_menuOverMenuItem('MMMenu0422215357_0');"> Current&nbsp;News </a> <a href="../subpages/news/archivenews.asp" id="MMMenu0422215357_0_Item_1" class="MMMIVStyleMMMenu0422215357_0" onmouseover="MM_menuOverMenuItem('MMMenu0422215357_0');"> Archive&nbsp;News </a> <a href="../subpages/news/newsletters.asp" id="MMMenu0422215357_0_Item_2" class="MMMIVStyleMMMenu0422215357_0" onmouseover="MM_menuOverMenuItem('MMMenu0422215357_0');"> Newsletters </a> <a href="../subpages/news/progresssofar.asp" id="MMMenu0422215357_0_Item_3" class="MMMIVStyleMMMenu0422215357_0" onmouseover="MM_menuOverMenuItem('MMMenu0422215357_0');"> Progress&nbsp;So&nbsp;Far </a></div>
            </div>
          </div></td>
        </tr>
        <tr>
          <td><div id="FWTableContainer2"> <a href="javascript:;" onmouseout="MM_menuStartTimeout(500);" onmouseover="MM_menuShowMenu('MMMenuContainer0428171938_0', 'MMMenu0428171938_0',190,0,'fwMenuRecDir_v1');"><img name="fwMenuRecDir_v1" src="../buttons/fwMenuRecDir_v1.png" width="190" height="34" border="0" id="fwMenuRecDir_v1" alt="" /></a>
            <div id="MMMenuContainer0428171938_0">
              <div id="MMMenu0428171938_0" onmouseout="MM_menuStartTimeout(500);" onmouseover="MM_menuResetTimeout();"> <a href="../subpages/visitorinfo/locationmaps.asp" id="MMMenu0428171938_0_Item_0" class="MMMIFVStyleMMMenu0428171938_0" onmouseover="MM_menuOverMenuItem('MMMenu0428171938_0');"> Location&nbsp;Maps </a> <a href="../subpages/visitorinfo/trackinfo.asp" id="MMMenu0428171938_0_Item_1" class="MMMIVStyleMMMenu0428171938_0" onmouseover="MM_menuOverMenuItem('MMMenu0428171938_0');"> Track&nbsp;Information </a> <a href="../subpages/visitorinfo/accommodation.asp" id="MMMenu0428171938_0_Item_2" class="MMMIVStyleMMMenu0428171938_0" onmouseover="MM_menuOverMenuItem('MMMenu0428171938_0');"> Accommodation </a> <a href="../subpages/visitorinfo/usefullinks.asp" id="MMMenu0428171938_0_Item_3" class="MMMIVStyleMMMenu0428171938_0" onmouseover="MM_menuOverMenuItem('MMMenu0428171938_0');"> Useful&nbsp;Links </a> </div>
            </div>
          </div></td>
        </tr>
        <tr>
          <td><a href="../subpages/general/contactus.asp"><img name="fwMenuContact_v1" src="../buttons/fwMenuContact_v1.png" width="190" height="34" border="0" id="fwMenuContact_v1" alt="" /></a></td>
        </tr>
        <tr>
          <td><a href="../subpages/general/donate.asp"><img name="fwMenuDonate_v1" src="../buttons/fwMenuDonate_v1.png" width="190" height="34" border="0" id="fwMenuDonate_v1" alt="" /></a></td>
        </tr>
        <tr>
          <td><div id="FWTableContainer3"> <a href="javascript:;" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuShowMenu('MMMenuContainer0428172835_0', 'MMMenu0428172835_0',190,0,'fwMenuSupporters_v1');"><img name="fwMenuSupporters_v1" src="../buttons/fwMenuSupporters_v1.png" width="190" height="34" border="0" id="fwMenuSupporters_v1" alt="" /></a>
            <div id="MMMenuContainer0428172835_0">
              <div id="MMMenu0428172835_0" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuResetTimeout();"> <a href="../subpages/supporters/majorsponsors.asp" id="MMMenu0428172835_0_Item_0" class="MMMIFVStyleMMMenu0428172835_0" onmouseover="MM_menuOverMenuItem('MMMenu0428172835_0');"> Major&nbsp;Sponsors </a> <a href="../subpages/supporters/howhelp.asp" id="MMMenu0428172835_0_Item_1" class="MMMIVStyleMMMenu0428172835_0" onmouseover="MM_menuOverMenuItem('MMMenu0428172835_0');"> How&nbsp;you&nbsp;can&nbsp;help </a></div>
            </div>
          </div></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td><div id="FWTableContainer"><a href="../home.asp" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuShowMenu('MMMenuContainer0424131240_0', 'MMMenu0424131240_0',190,0,'fwMenuProjectAim_v2');"><img name="fwMenuProjectAim_v2" src="../buttons/fwMenuProjectAim_v2.png" width="190" height="34" border="0" id="fwMenuProjectAim_v2" alt="" /></a>
            <div id="MMMenuContainer0424131240_0">
              <div id="MMMenu0424131240_0" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuResetTimeout();"> <a href="../subpages/projectaims/aboutmtt.asp" id="MMMenu0424131240_0_Item_0" class="MMMIFVStyleMMMenu0424131240_0" onmouseover="MM_menuOverMenuItem('MMMenu0424131240_0');"> About&nbsp;Maungatautari </a> <a href="../subpages/projectaims/projectgoals.asp" id="MMMenu0424131240_0_Item_1" class="MMMIVStyleMMMenu0424131240_0" onmouseover="MM_menuOverMenuItem('MMMenu0424131240_0');"> Project&nbsp;Goals </a> <a href="../subpages/projectaims/protectingmana.asp" id="MMMenu0424131240_0_Item_2" class="MMMIVStyleMMMenu0424131240_0" onmouseover="MM_menuOverMenuItem('MMMenu0424131240_0');"> Protecting&nbsp;the&nbsp;Mana </a> <a href="../subpages/projectaims/whymtt.asp" id="MMMenu0424131240_0_Item_3" class="MMMIVStyleMMMenu0424131240_0" onmouseover="MM_menuOverMenuItem('MMMenu0424131240_0');"> Why&nbsp;Choose&nbsp;Maungatautari </a> <a href="../subpages/projectaims/whynz.asp" id="MMMenu0424131240_0_Item_4" class="MMMIVStyleMMMenu0424131240_0" onmouseover="MM_menuOverMenuItem('MMMenu0424131240_0');"> Why&nbsp;Choose&nbsp;New&nbsp;Zealand </a></div>
            </div>
          </div></td>
        </tr>
        <tr>
          <td><div id="FWTableContainer4"> <a href="javascript:;" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuShowMenu('MMMenuContainer0428213712_0', 'MMMenu0428213712_0',190,0,'fwMenuMT_v1');"><img name="fwMenuMT_v1" src="../buttons/fwMenuMT_v1.png" width="190" height="34" border="0" id="fwMenuMT_v1" alt="" /></a>
            <div id="MMMenuContainer0428213712_0">
              <div id="MMMenu0428213712_0" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuResetTimeout();"> <a href="../subpages/maungatrust/trustees.asp" id="MMMenu0428213712_0_Item_0" class="MMMIFVStyleMMMenu0428213712_0" onmouseover="MM_menuOverMenuItem('MMMenu0428213712_0');"> Trustees/Management </a> <a href="../subpages/maungatrust/committees.asp" id="MMMenu0428213712_0_Item_1" class="MMMIVStyleMMMenu0428213712_0" onmouseover="MM_menuOverMenuItem('MMMenu0428213712_0');"> Committees </a> <a href="../subpages/maungatrust/volunteers.asp" id="MMMenu0428213712_0_Item_2" class="MMMIVStyleMMMenu0428213712_0" onmouseover="MM_menuOverMenuItem('MMMenu0428213712_0');"> Volunteers </a></div>
            </div>
          </div></td>
        </tr>
        <tr>
          <td><div id="FWTableContainer5"> <a href="javascript:;" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuShowMenu('MMMenuContainer0428214411_0', 'MMMenu0428214411_0',190,0,'fwMenuMountainRest_v1');"><img name="fwMenuMountainRest_v1" src="../buttons/fwMenuMountainRest_v1.png" width="190" height="34" border="0" id="fwMenuMountainRest_v1" alt="" /></a>
            <div id="MMMenuContainer0428214411_0">
              <div id="MMMenu0428214411_0" onmouseout="MM_menuStartTimeout(10);" onmouseover="MM_menuResetTimeout();"> <a href="../restoration.asp" id="MMMenu0428214411_0_Item_0" class="MMMIFVStyleMMMenu0428214411_0" onmouseover="MM_menuOverMenuItem('MMMenu0428214411_0');"> Restoration </a> <a href="../subpages/mountainrestoration/pesteradication.asp" id="MMMenu0428214411_0_Item_1" class="MMMIVStyleMMMenu0428214411_0" onmouseover="MM_menuOverMenuItem('MMMenu0428214411_0');"> Pest&nbsp;Eradication </a> <a href="../subpages/mountainrestoration/pestfence.asp" id="MMMenu0428214411_0_Item_2" class="MMMIVStyleMMMenu0428214411_0" onmouseover="MM_menuOverMenuItem('MMMenu0428214411_0');"> The&nbsp;Pest&nbsp;Proof&nbsp;Fence </a> <a href="../subpages/mountainrestoration/thebirds.asp" id="MMMenu0428214411_0_Item_3" class="MMMIVStyleMMMenu0428214411_0" onmouseover="MM_menuOverMenuItem('MMMenu0428214411_0');"> The&nbsp;Birds </a> <a href="../subpages/mountainrestoration/theflora.asp" id="MMMenu0428214411_0_Item_4" class="MMMIVStyleMMMenu0428214411_0" onmouseover="MM_menuOverMenuItem('MMMenu0428214411_0');"> The&nbsp;Flora </a> <a href="../subpages/mountainrestoration/theinvertebrates.asp" id="MMMenu0428214411_0_Item_5" class="MMMIVStyleMMMenu0428214411_0" onmouseover="MM_menuOverMenuItem('MMMenu0428214411_0');"> The&nbsp;Invertebrates </a> <a href="../subpages/mountainrestoration/theamphibians.asp" id="MMMenu0428214411_0_Item_6" class="MMMIVStyleMMMenu0428214411_0" onmouseover="MM_menuOverMenuItem('MMMenu0428214411_0');"> The&nbsp;Amphibians </a> <a href="../subpages/mountainrestoration/thereptiles.asp" id="MMMenu0428214411_0_Item_7" class="MMMIVStyleMMMenu0428214411_0" onmouseover="MM_menuOverMenuItem('MMMenu0428214411_0');"> The&nbsp;Reptiles </a> <a href="../subpages/mountainrestoration/thefish.asp" id="MMMenu0428214411_0_Item_8" class="MMMIVStyleMMMenu0428214411_0" onmouseover="MM_menuOverMenuItem('MMMenu0428214411_0');"> The&nbsp;Fish </a></div>
            </div>
          </div></td>
        </tr>
        <tr>
          <td><a href="../subpages/tangata/tangatawhenua.asp"><img name="fwMenuTangataWhenua_v1" src="../buttons/fwMenuTangataWhenua_v1.png" width="190" height="34" border="0" id="fwMenuTangataWhenua_v1" alt="" /></a></td>
        </tr>
        <tr>
          <td><a href="../subpages/general/maungahistory.asp"><img name="fwMenuHistory_v1" src="../buttons/fwMenuHistory_v1.png" width="190" height="34" border="0" id="fwMenuHistory_v1" alt="" /></a></td>
        </tr>
        <tr>
          <td><a href="../subpages/research/research.asp"><img name="fwMenuResearch_v1" src="../buttons/fwMenuResearch_v1.png" width="190" height="34" border="0" id="fwMenuResearch_v1" alt="" /></a></td>
        </tr>
        <tr>
          <td><a href="../subpages/education/introduction.asp"><img name="fwMenuEdu_v2" src="../buttons/fwMenuEdu_v2.png" width="190" height="34" border="0" id="fwMenuEdu_v2" alt="" /></a></td>
        </tr>
        <tr>
          <td><a href="../subpages/general/downloads.asp"><img name="fwMenuDownloads_v1" src="../buttons/fwMenuDownloads_v1.png" width="190" height="34" border="0" id="fwMenuDownloads_v1" alt="" /></a></td>
        </tr>
        <tr>
          <td><a href="../subpages/general/gallery.asp"><img name="fwMenuVisitors_v1" src="../buttons/fwMenuVisitors_v1.png" width="190" height="34" border="0" id="fwMenuVisitors_v1" alt="" /></a></td>
        </tr>
      </table>
</div>
<div id="header_bar"><img src="../images/header/aiMTTHeaderBar.png" width="706" height="35" /></div>
<!-- InstanceBeginEditable name="content_header" -->
<div id="content_header_admin">
  <% 
			While ((Repeat1__numRows <> 0) AND (NOT rsPages.EOF)) 
			%>
  <table border="0" class="tbmenu">
    <tr>
      <td class="menu_arrow"><img src="<%=(rsCommon.Fields.Item("menuarrow").Value)%>" /></td>
      <td class="menu_text_white"><a href="<%=(rsPages.Fields.Item("pagelink").Value)%>"><%=(rsPages.Fields.Item("pagename").Value)%></a></td>
    </tr>
  </table>
  <% 
			  Repeat1__index=Repeat1__index+1
			  Repeat1__numRows=Repeat1__numRows-1
			  rsPages.MoveNext()
			Wend
			%>
</div>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="content_main" -->
<div id="content_main_admin">
<form action="<%=MM_editAction%>" method="POST" name="fmNewNews">
	<table width="100%" border="0">
      <tr>
        <td width="16%">Record ID</td>
        <td width="84%"><%=(rsnewnews.Fields.Item("idnews").Value)%></td>
      </tr>
      <tr>
        <td>Anchorid</td>
        <td><input name="anchorid" type="text" id="anchorid" value="<%=(rsnewnews.Fields.Item("anchorid").Value)%>" size="60" /></td>
      </tr>
      <tr>
        <td>Menulink</td>
        <td><input name="menulink" type="text" id="menulink" value="<%=(rsnewnews.Fields.Item("menulink").Value)%>" size="60" /></td>
      </tr>
      <tr>
        <td>Heading</td>
        <td><input name="heading" type="text" id="heading" value="<%=(rsnewnews.Fields.Item("heading").Value)%>" size="60" /></td>
      </tr>
      <tr>
        <td>Newsdate</td>
        <td><input name="newsdate" type="text" id="newsdate" value="<%=(rsnewnews.Fields.Item("newsdate").Value)%>" size="40" /></td>
      </tr>
      <tr>
        <td>Newsyear</td>
        <td><input name="newsyear" type="text" id="newsyear" value="<%=(rsnewnews.Fields.Item("newsyear").Value)%>" size="20" /></td>
      </tr>
      <tr>
        <td>contentmain</td>
        <td>&nbsp;
          <%
'**************************
'  WYSIWYG HTML Editor
'  http://www.DwZone.it
'  Version: 2.0.2
'**************************
Set oFCKeditor = New FCKeditor
sBasePath = "../FckEditor/"
oFCKeditor.ToolbarSet = "DwZone"
oFCKeditor.TestWritePermission = "false"
oFCKeditor.UploadFolder = ""
oFCKeditor.BasePath = sBasePath
oFCKeditor.SkinPath = sBasePath + "skins/Office2007Real/"
oFCKeditor.FontList = "Calibri"
oFCKeditor.FontSizes = "smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large"
oFCKeditor.ResizeOptions = "0;0;0;0;80;0"
oFCKeditor.OthersOptions = ";false;0;;false;0;_;false;false;false;false;false;false;true;850;500;p;true;en;0;false;false;false;ltr;br;FFFFFF;50;false;0"
oFCKeditor.AllowedFileType = "allowedFile=&deniedFile=php|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|com|dll|vbs|js|reg|mdb&allowedImage=jpg|gif|jpeg|png|bmp&deniedImage="
oFCKeditor.ToolbarList = "0_5_6_7_8_9_17_12_13_18_19_20_-1_24_25_26_27_28_29_30_31_32_33_-1_36_39_42_43_45_46_47_-1_67_48_34"
oFCKeditor.Width = "400"
oFCKeditor.Height = "250"
oFCKeditor.Value = ""
oFCKeditor.Create "contentmain"
%>
          <textarea name="contentmain" id="contentmain" rows="4" cols="40" style="height:250;width:400;display:<%=oFCKeditor.getDisplay()%>"><%=(rsnewnews.Fields.Item("contentmain").Value)%></textarea></td>
      </tr>
      <tr>
        <td>photolink</td>
        <td><input name="photolink" type="text" id="photolink" value="<%=(rsnewnews.Fields.Item("photolink").Value)%>" size="60" /></td>
      </tr>
      <tr>
        <td>photocaption</td>
        <td><input name="photocaption" type="text" id="photocaption" value="<%=(rsnewnews.Fields.Item("photocaption").Value)%>" size="60" /></td>
      </tr>
      <tr>
        <td>photocredit</td>
        <td><input name="photocredit" type="text" id="photocredit" value="<%=(rsnewnews.Fields.Item("photocredit").Value)%>" size="60" /></td>
      </tr>
      <tr>
        <td>currentnews</td>
        <td><input name="currentnews" type="text" id="currentnews" value="<%=(rsnewnews.Fields.Item("currentnews").Value)%>" size="4" /></td>
      </tr>
      <tr>
        <td>archivenews</td>
        <td><input name="archivenews" type="text" id="archivenews" value="<%=(rsnewnews.Fields.Item("archivenews").Value)%>" size="4" /></td>
      </tr>
      <tr>
        <td>progresssofar</td>
        <td><input name="progresssofar" type="text" id="progresssofar" value="<%=(rsnewnews.Fields.Item("progresssofar").Value)%>" size="4" /></td>
      </tr>
      <tr>
        <td>menuselect</td>
        <td><input name="menuselect" type="text" id="menuselect" value="<%=(rsnewnews.Fields.Item("menuselect").Value)%>" size="4" /></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><a href="<%=MM_moveFirst%>">First</a><a href="<%=MM_moveNext%>">Next</a><a href="<%=MM_movePrev%>">Previous</a><a href="<%=MM_moveLast%>">Last</a></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><input type="submit" name="Update" id="Update" value="Update" /></td>
      </tr>
    </table>
    <input type="hidden" name="MM_update" value="fmNewNews" />
    <input type="hidden" name="MM_recordId" value="<%= rsnewnews.Fields.Item("idnews").Value %>" />
</form>
</div>
  			<!-- InstanceEndEditable -->
</div>
</body>
<!-- InstanceEnd --></html>
<%
rsCommon.Close()
Set rsCommon = Nothing
%>
<%
rsPages.Close()
Set rsPages = Nothing
%>
<%
rsnewnews.Close()
Set rsnewnews = Nothing
%>
<!-- #INCLUDE file="../FckEditor/inc/fckeditor.asp" -->

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Hi I commented out the code section below where the error is located.  This allows my page to load and function however now it does not know how many records there are so if I try to move to the last record I get an error. I can however scroll through the records.

This temporarily gets me working again but obviously as the number of records grows it becomes impraticle to scroll through a large number of records

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

Open in new window

Commented:
The problem is related to the type of connection you have and you trying to either requery or move to the first record.  Can you use a Response.Write (with those other lines commented out) to see what the CursorType value is?  E.g.
Response.Write "The cursortype is " & MM_rs.CursorType & "<br />"
Also please show us or provide details for the code that makes the connection.  It is probably done in the Include file.  Unfortunately I can't provide details on how to find this in Dreamweaver since I don't use that program (I really don't like the code it makes).  If another expert responds who knows DW then they might be even more help with the DW specific stuff and more familiar with their code and methods.
Let me know what you find or if you have a question about any of this.  Do you need to do the step to "reset the cursor"?  Certain connections won't allow this so most likely that is the issue.
bol
 
I have now used an extension for recordset paging from DWZONE that gets rid of this issue

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial