Skip to main content
Participating Frequently
June 10, 2011
Question

Requery Recordset

  • June 10, 2011
  • 1 reply
  • 1022 views

I have another issue with my summary/update processing. I have a form where members can list themselves for either needing or wanting boat/crew/housing. Below the form is a listing of all associated requests:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/ilcaData.asp" -->
<!--#include file="../../Connections/eventCalendar.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_insert")) = "needavailadd") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
    MM_editCmd.CommandText = "INSERT INTO needAvail (naType, memName, city, [state], phone, email, info, eventID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 3, Request.Form("naType")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 32, Request.Form("memName")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 18, Request.Form("city")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 2, Request.Form("state")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 12, Request.Form("phone")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 48, Request.Form("email")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 75, Request.Form("info")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 5, 1, -1, MM_IIF(Request.Form("eventID"), Request.Form("eventID"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "eventneedavail.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 rsStates
Dim rsStates_cmd
Dim rsStates_numRows

Set rsStates_cmd = Server.CreateObject ("ADODB.Command")
rsStates_cmd.ActiveConnection = MM_ilcaData_STRING
rsStates_cmd.CommandText = "SELECT * FROM stateCodes"
rsStates_cmd.Prepared = true

Set rsStates = rsStates_cmd.Execute
rsStates_numRows = 0
%>
<%
Dim rsneedavailReq
Dim rsneedavailReq_cmd
Dim rsneedavailReq_numRows

Set rsneedavailReq_cmd = Server.CreateObject ("ADODB.Command")
rsneedavailReq_cmd.ActiveConnection = MM_eventCalendar_STRING
rsneedavailReq_cmd.CommandText = "SELECT * FROM needAvailReq"
rsneedavailReq_cmd.Prepared = true

Set rsneedavailReq = rsneedavailReq_cmd.Execute
rsneedavailReq_numRows = 0
%>
<%
Dim rsneedAvail__MMColParam
rsneedAvail__MMColParam = "0"
If (Request.Querystring("ID")  <> "") Then
  rsneedAvail__MMColParam = Request.Querystring("ID")
End If
%>
<%
Dim rsneedAvail
Dim rsneedAvail_cmd
Dim rsneedAvail_numRows

Set rsneedAvail_cmd = Server.CreateObject ("ADODB.Command")
rsneedAvail_cmd.ActiveConnection = MM_eventCalendar_STRING
rsneedAvail_cmd.CommandText = "SELECT * FROM eventneedAvail WHERE eventID = ?"
rsneedAvail_cmd.Prepared = true
rsneedAvail_cmd.Parameters.Append rsneedAvail_cmd.CreateParameter("param1", 5, 1, -1, rsneedAvail__MMColParam) ' adDouble

Set rsneedAvail = rsneedAvail_cmd.Execute
rsneedAvail_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsneedAvail_numRows = rsneedAvail_numRows + Repeat1__numRows
%>
<!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">
<!-- InstanceBegin template="/Templates/mainLayout.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Welcome to the International Lightning Class</title>
<meta name="Keywords" content="Lightning, lightning sailboat, lightning class, international lightning class, lightning class sailboat, lightning class association" />
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="../../assets/favicon.ico" rel="shortcut icon" />
<link href="../../css/mainLayout2.css" rel="stylesheet" type="text/css" />
<link href="../../css/navMenu.css" rel="stylesheet" type="text/css" />
<link href="../../css/ilcaStyles.css" rel="stylesheet" type="text/css" />
<link href="../../css/document.css" rel="stylesheet" type="text/css" />
<script src="../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<!-- InstanceBeginEditable name="styles" -->
<link href="../../css/needAvail.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
//-->
</script>
<!-- InstanceEndEditable -->
<!-- InstanceParam name="setdatetype" type="text" value="" -->
<!-- InstanceParam name="cleanup" type="text" value="" -->
</head>
<body onload="" onunload="">
<%
Response.Buffer = True
If (Request.ServerVariables("HTTPS") = "on") Then
    Dim xredir__, xqstr__

    xredir__ = "http://" & Request.ServerVariables("SERVER_NAME") & _
               Request.ServerVariables("SCRIPT_NAME")
    xqstr__ = Request.ServerVariables("QUERY_STRING")

    if xqstr__ <> "" Then xredir__ = xredir__ & "?" & xqstr__

    Response.redirect xredir__
End if
%>
<div id="wrapper">
  <div id="header">
    <div id="hdrLink"><a href="../../index.asp"><img src="../../assets/images/mainTemplate/headerImg.png" width="839" height="183" border="0" /></a></div>
  </div>
  <div id="sidebar">
    <div id="navigation">
      <!-- menu script itself. you should not modify this file -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu.js"></script>
      <!-- items structure. menu hierarchy and links are stored there -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_items.js"></script>
      <!-- files with geometry and styles structures -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_tpl2.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_tpl.js"></script>
      <script type="text/javascript" language="javascript">
<!--//
// Make sure the menu initialization is right above the closing &lt;/body&gt; tag
// Moving it inside other tags will not affect the position of the menu on
// the page. If you need this feature please consider Tigra Menu GOLD.

// each menu gets two parameters (see demo files)
// 1. items structure
// 2. geometry structure

new menu (MENU_ITEMS, MENU_TPL);

// If you don't see the menu then check JavaScript console of the browser for the error messages
// "Variable is not defined" error indicates that there's syntax error in that variable's definition
// or the file with that variable isn't properly linked to the HTML document
//-->
</script>
    </div>
    <div id="sbar-image3"> <a href="http://www.facebook.com/pages/International-Lightning-Class-Association/197584991571" target="_blank"><img src="../../assets/images/mainTemplate/facebook.png" alt="Facebook ILCA link" width="36" height="36" border="0" /></a>  <a href="http://twitter.com/IntLightning" target="_blank"><img src="../../assets/images/mainTemplate/twitter.png" alt="Twitter ILCA link" width="36" height="36" border="0" /></a> Connect with us</span></span></span> <br />
    </div>
    <div id="sbarSearch">
      <!-- SiteSearch Google -->
      <FORM method=GET action="http://www.google.com/search">
        <input type=hidden name=ie value=UTF-8>
        <input type=hidden name=oe value=UTF-8>
        <TABLE width="126" align="center" bgcolor="#FFFFFF">
          <tr>
            <td width="135"><img src="../../assets/images/mainTemplate/google.jpg" width="68" height="21" alt="Google logo" /></td>
          </tr>
          <tr>
            <td><input type=text name=q size=20 maxlength=255 value="" />
              <input type=submit name=btnG value="Google Search" />
              <font size=-2>
              <input type=hidden name=domains value="www.lightningclass.org">
              <br>
              <input type=radio

name=sitesearch value="">
              Web
              <input type=radio name=sitesearch value="www.lightningclass.org" checked>
              Site<br>
              </font></td>
          </tr>
        </TABLE>
      </FORM>
      <!-- SiteSearch Google -->
    </div>
    <div id="sbarTranslate">
      <script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up_source_language=en&w=148&h=60&title=&border=&output=js"></script>
    </div>
    <div id="sbar-image1"><a href="http://www.guadalajara2011.org.mx/esp/01_inicio/index.asp"><img src="../../assets/images/mainTemplate/panAm.jpg" width="116" height="129" border="0" /></a></div>
    <div id="sbar-image2"><a href="../../membership/joinRenew/membershipOptions.asp"><img src="../../assets/images/mainTemplate/joinILCA.png" alt="Join the ILCA" width="113" height="113" border="0" /></a></div>
  </div>
  <div id="background">
    <div id="mainContent"> <!-- InstanceBeginEditable name="mainContent" -->
      <div id="docHdr"> Header </div>
      <div id="docBody">
        <div id="listMe">
          <form ACTION="<%=MM_editAction%>" METHOD="POST" name="needavailadd">
            <fieldset id="needavailAdd" name="needavailAdd">
              <legend class="legend">Logistics-Add</legend>
              <br />
              <label for="naType">Request Type:</label>
              <label>
                <select name="naType" size="1" id="naType" tabindex="1">
                  <option value="Sel" <%If (Not isNull(" Select a request type")) Then If ("Sel" = CStr(" Select a request type")) Then Response.Write("selected=""selected""") : Response.Write("")%>> Select a request type</option>
                  <%
While (NOT rsneedavailReq.EOF)
%>
                  <option value="<%=(rsneedavailReq.Fields.Item("requestKey").Value)%>" <%If (Not isNull(" Select a request type")) Then If (CStr(rsneedavailReq.Fields.Item("requestKey").Value) = CStr(" Select a request type")) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsneedavailReq.Fields.Item("requestType").Value)%></option>
                  <%
  rsneedavailReq.MoveNext()
Wend
If (rsneedavailReq.CursorType > 0) Then
  rsneedavailReq.MoveFirst
Else
  rsneedavailReq.Requery
End If
%>
                </select>
              </label>
              <br />
              <br />
              <label>First and Last Name:
                <input name="memName" type="text" id="memName" tabindex="2" onblur="MM_validateForm('memName','','R');return document.MM_returnValue" />
              </label>
              <br />
              <br />
              <label>City:
                <input name="city" type="text" id="city" tabindex="3" onblur="MM_validateForm('city','','R');return document.MM_returnValue" />
              </label>
              <label>State: </label>
              <label>
                <select name="state" size="1" id="state" tabindex="4" onchange="MM_validateForm('phone','','NisNum');MM_validateForm('email','','NisEmail');return document.MM_returnValue">
                  <option value="Sel" <%If (Not isNull(" Select a state")) Then If ("Sel" = CStr(" Select a state")) Then Response.Write("selected=""selected""") : Response.Write("")%>> Select a state</option>
                  <%
While (NOT rsStates.EOF)
%>
                  <option value="<%=(rsStates.Fields.Item("stateCode").Value)%>" <%If (Not isNull(" Select a state")) Then If (CStr(rsStates.Fields.Item("stateCode").Value) = CStr(" Select a state")) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsStates.Fields.Item("stateName").Value)%></option>
                  <%
  rsStates.MoveNext()
Wend
If (rsStates.CursorType > 0) Then
  rsStates.MoveFirst
Else
  rsStates.Requery
End If
%>
                </select>
              </label>
              <br />
              <br />
              <label>Telephone#:
                <input type="text" name="phone" id="phone" tabindex="5" />
              </label>
              <br />
              <br />
              <label>Email:
                <input name="email" type="text" id="email" tabindex="6" size="48" maxlength="48" />
              </label>
              <br />
              <br />
              <label>Additional Information:
                <input name="info" type="text" id="info" tabindex="7" size="58" maxlength="255" />
              </label>
              <br />
              <br />
              <input type="submit" name="addButton" id="addButton" value="Add Me" tabindex="8" />
                 
              <input type="reset" name="reset" id="reset" value="Reset" />
            </fieldset>
            <input name="eventID" type="hidden" id="eventID" value="<%=Request.QueryString("ID")%>" />
            <input type="hidden" name="MM_insert" value="needavailadd" />

          </form>
        </div>
        <div id="nameList">
          <table width=640 align=left>
            <% if rsneedAvail.EOF then
   response.write "<strong>No Requests Yet</strong>"
  else
  response.write "<strong>" & (rsneedAvail_total) & "</strong>"
  response.write "<strong> Logistics Requests:</strong>"%>
          <p align="left"> </p>
          <% icat = rsneedAvail.Fields.Item("requestType").Value %>
            <tr>
              <td colspan='2' class="eventMonths"><%=(rsneedAvail.Fields.Item("requestType").Value)%></td>
            </tr>
            <tr>
              <td colspan='2'><hr width=250% align="center"/></td>
            </tr>
     <%rsneedAvail.Requery%>
            <% While ((Repeat1__numRows <> 0) AND (NOT rsneedAvail.EOF)) %>
              <% If rsneedAvail.Fields.Item("requestType").Value <> icat then
    icat = rsneedAvail.Fields.Item("requestType").Value%>
              <tr height="20">
                <td colspan='2'></td>
              </tr>
              <tr>
                <td colspan='2' class="eventMonths"><%=(rsneedAvail.Fields.Item("requestType").Value)%></td>
              </tr>
              <tr>
                <td colspan='2'><hr width=250% align="center"/></td>
              </tr>
              <%End If %>
              <tr>
                <td width="165"><%=(rsneedAvail.Fields.Item("name").Value)%></td>
                <td width="150"><%=(rsneedAvail.Fields.Item("location").Value)%></td>
                <td width="100"><%=(rsneedAvail.Fields.Item("phone").Value)%></td>
                <td width="265"><%=(rsneedAvail.Fields.Item("info").Value)%></td>
                <td width="30" class="hpResults" aligm="left"><div align="center"><a href="eventneedavailUpdate.asp?ID=<%=(rsneedAvail.Fields.Item("recID").Value)%>"><span class="eventeditLink">Edit</span></a></div></td>
                <td width="30" class="hpResults" aligm="left"><div align="center"><a href="eventupdateLogin.asp?ID=<%=(rsneedAvail.Fields.Item("recID").Value)%>"><span class="eventeditLink">Delete</span></a></div></td>
              </tr>
              <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsneedAvail.MoveNext()
Wend
        end if
        %>
          </table>
        </div>
      </div>
      <!-- InstanceEndEditable --></div>
  </div>
  <div id="clear"></div>
  <div id="footer">
    <p><u><a href="../../membership/joinRenew/membershipOptions.asp" class="ftrLinks">Membership</a></u> | <u><a href="eventSelect.asp" class="ftrLinks">Racing</a></u> | <u><a href="../../classRules/documents/ilcaBylaws.asp" class="ftrLinks">Class Rules</a></u> | <u><a href="../../photoGallery/photos2008/index.asp" class="ftrLinks">Photo Gallery</a></u> | <u class="ftrLinks"><a href="../../marketplace/store/index.asp">Marketplace</a></u> | <u><a href="../../contacts/index.asp" class="ftrLinks">Contacts</a></u> | <u class="ftrLinks"><a href="../../siteMap.asp">Site Map</a></u><br />
      All Rights Reserved—International Lightning Class Association<br />
      <u><a href="mailto:office@lightningclass.org" class="ftrLinks">office@lightningclass.org</a></u><br />
      1528 Big Bass Drive, Tarpon Springs, Florida  34689— Phone: 727-942-7969 — Fax: 727-942-0173 — Skype: ilcaoffice</p>
  </div>
</div>
</body>
<!-- InstanceEnd -->
</html>
<%
rsStates.Close()
Set rsStates = Nothing
%>
<%
rsneedavailReq.Close()
Set rsneedavailReq = Nothing
%>
<%
rsneedAvail.Close()
Set rsneedAvail = Nothing
%>


Entries may be updated. After the update, the page above is displayed. Sometimes the updated information displays, but more often it does not (????). I have tried a requery, but that is not working. How do I requery the recordset so that the current information always displays?

Update page:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/ilcaData.asp" -->
<!--#include file="../../Connections/eventCalendar.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")) = "needavailUpdate") Then
  If (Not MM_abortEdit) Then
    ' execute the update
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
    MM_editCmd.CommandText = "UPDATE needAvail SET naType = ?, memName = ?, city = ?, [state] = ?, phone = ?, email = ?, info = ? WHERE recID = ?"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 3, Request.Form("naType")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 32, Request.Form("memName")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 18, Request.Form("city")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 2, Request.Form("state")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 12, Request.Form("phone")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 48, Request.Form("email")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 75, Request.Form("info")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 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 = "eventneedavail.asp?ID=" & Request.Form("eventID")
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl
      Else
        MM_editRedirectUrl = MM_editRedirectUrl
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<%
Dim rsStates
Dim rsStates_cmd
Dim rsStates_numRows

Set rsStates_cmd = Server.CreateObject ("ADODB.Command")
rsStates_cmd.ActiveConnection = MM_ilcaData_STRING
rsStates_cmd.CommandText = "SELECT * FROM stateCodes"
rsStates_cmd.Prepared = true

Set rsStates = rsStates_cmd.Execute
rsStates_numRows = 0
%>
<%
Dim rsneedavailReq
Dim rsneedavailReq_cmd
Dim rsneedavailReq_numRows

Set rsneedavailReq_cmd = Server.CreateObject ("ADODB.Command")
rsneedavailReq_cmd.ActiveConnection = MM_eventCalendar_STRING
rsneedavailReq_cmd.CommandText = "SELECT * FROM needavailReq"
rsneedavailReq_cmd.Prepared = true

Set rsneedavailReq = rsneedavailReq_cmd.Execute
rsneedavailReq_numRows = 0
%>
<%
Dim rsneedAvail__MMColParam
rsneedAvail__MMColParam = "0"
If (Request.QueryString("ID")  <> "") Then
  rsneedAvail__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim rsneedAvail
Dim rsneedAvail_cmd
Dim rsneedAvail_numRows

Set rsneedAvail_cmd = Server.CreateObject ("ADODB.Command")
rsneedAvail_cmd.ActiveConnection = MM_eventCalendar_STRING
rsneedAvail_cmd.CommandText = "SELECT * FROM needAvail WHERE recID = ?"
rsneedAvail_cmd.Prepared = true
rsneedAvail_cmd.Parameters.Append rsneedAvail_cmd.CreateParameter("param1", 5, 1, -1, rsneedAvail__MMColParam) ' adDouble

Set rsneedAvail = rsneedAvail_cmd.Execute
rsneedAvail_numRows = 0
%>
<%
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
%>
<!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"><!-- InstanceBegin template="/Templates/mainLayout.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Welcome to the International Lightning Class</title>
<meta name="Keywords" content="Lightning, lightning sailboat, lightning class, international lightning class, lightning class sailboat, lightning class association" />
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="../../assets/favicon.ico" rel="shortcut icon" />
<link href="../../css/mainLayout2.css" rel="stylesheet" type="text/css" />
<link href="../../css/navMenu.css" rel="stylesheet" type="text/css" />
<link href="../../css/ilcaStyles.css" rel="stylesheet" type="text/css" />
<link href="../../css/document.css" rel="stylesheet" type="text/css" />
<script src="../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<!-- InstanceBeginEditable name="styles" -->
<link href="../../css/needAvail.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
<!-- InstanceParam name="setdatetype" type="text" value="" -->
<!-- InstanceParam name="cleanup" type="text" value="" -->
</head>
<body onload="" onunload="">
<%
Response.Buffer = True
If (Request.ServerVariables("HTTPS") = "on") Then
    Dim xredir__, xqstr__

    xredir__ = "http://" & Request.ServerVariables("SERVER_NAME") & _
               Request.ServerVariables("SCRIPT_NAME")
    xqstr__ = Request.ServerVariables("QUERY_STRING")

    if xqstr__ <> "" Then xredir__ = xredir__ & "?" & xqstr__

    Response.redirect xredir__
End if
%>
<div id="wrapper">
  <div id="header">
    <div id="hdrLink"><a href="../../index.asp"><img src="../../assets/images/mainTemplate/headerImg.png" width="839" height="183" border="0" /></a></div>
  </div>
  <div id="sidebar">
    <div id="navigation">
      <!-- menu script itself. you should not modify this file -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu.js"></script>
      <!-- items structure. menu hierarchy and links are stored there -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_items.js"></script>
      <!-- files with geometry and styles structures -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_tpl2.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_tpl.js"></script>
      <script type="text/javascript" language="javascript">
<!--//
// Make sure the menu initialization is right above the closing &lt;/body&gt; tag
// Moving it inside other tags will not affect the position of the menu on
// the page. If you need this feature please consider Tigra Menu GOLD.

// each menu gets two parameters (see demo files)
// 1. items structure
// 2. geometry structure

new menu (MENU_ITEMS, MENU_TPL);

// If you don't see the menu then check JavaScript console of the browser for the error messages
// "Variable is not defined" error indicates that there's syntax error in that variable's definition
// or the file with that variable isn't properly linked to the HTML document
//-->
</script>
    </div>
    <div id="sbar-image3"> <a href="http://www.facebook.com/pages/International-Lightning-Class-Association/197584991571" target="_blank"><img src="../../assets/images/mainTemplate/facebook.png" alt="Facebook ILCA link" width="36" height="36" border="0" /></a>  <a href="http://twitter.com/IntLightning" target="_blank"><img src="../../assets/images/mainTemplate/twitter.png" alt="Twitter ILCA link" width="36" height="36" border="0" /></a>
      Connect with us</span></span></span>
       <br />
    </div>
    <div id="sbarSearch">
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<TABLE width="126" align="center" bgcolor="#FFFFFF"><tr><td width="135"><img src="../../assets/images/mainTemplate/google.jpg" width="68" height="21" alt="Google logo" />
</td></tr>
<tr>
<td><input type=text name=q size=20 maxlength=255 value="" />
  <input type=submit name=btnG value="Google Search" />
  <font size=-2>
<input type=hidden name=domains value="www.lightningclass.org"><br><input type=radio

name=sitesearch value=""> Web
<input type=radio name=sitesearch value="www.lightningclass.org" checked>
Site<br>
</font>
</td></tr></TABLE>
</FORM>
<!-- SiteSearch Google -->
    </div>
    <div id="sbarTranslate">
      <script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up_source_language=en&w=148&h=60&title=&border=&output=js"></script>
    </div>
    <div id="sbar-image1"><a href="http://www.guadalajara2011.org.mx/esp/01_inicio/index.asp"><img src="../../assets/images/mainTemplate/panAm.jpg" width="116" height="129" border="0" /></a></div>
    <div id="sbar-image2"><a href="../../membership/joinRenew/membershipOptions.asp"><img src="../../assets/images/mainTemplate/joinILCA.png" alt="Join the ILCA" width="113" height="113" border="0" /></a></div>
  </div>
  <div id="background">
    <div id="mainContent"> <!-- InstanceBeginEditable name="mainContent" -->
      <div id="docHdr"> Header </div>
      <div id="docBody">
        <div id="listMe">
          <form ACTION="<%=MM_editAction%>" METHOD="POST" name="needavailUpdate">
            <fieldset id="needavailUpdate" name="needavailUpdate">
              <legend class="legend">Need/Available</legend>
              <br />
              <label for="naType">Request Type:</label>
              <label>
                <select name="naType" id="naType" tabindex="1">
                  <option value="" <%If (Not isNull((rsneedAvail.Fields.Item("naType").Value))) Then If ("" = CStr((rsneedAvail.Fields.Item("naType").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>></option>
                  <%
While (NOT rsneedavailReq.EOF)
%>
                  <option value="<%=(rsneedavailReq.Fields.Item("requestKey").Value)%>" <%If (Not isNull((rsneedAvail.Fields.Item("naType").Value))) Then If (CStr(rsneedavailReq.Fields.Item("requestKey").Value) = CStr((rsneedAvail.Fields.Item("naType").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsneedavailReq.Fields.Item("requestType").Value)%></option>
                  <%
  rsneedavailReq.MoveNext()
Wend
If (rsneedavailReq.CursorType > 0) Then
  rsneedavailReq.MoveFirst
Else
  rsneedavailReq.Requery
End If
%>
                </select>
              </label>
              <br />
              <br />
              <label>First and Last Name:
                <input name="memName" type="text" id="memName" tabindex="2" value="<%=(rsneedAvail.Fields.Item("memName").Value)%>" />
              </label>
              <br />
              <br />
              <label>City:
                <input name="city" type="text" id="city" tabindex="3" value="<%=(rsneedAvail.Fields.Item("city").Value)%>" />
              </label>
              <label>State: </label>
              <label>
                <select name="state" id="state" tabindex="4">
                  <option value="" <%If (Not isNull((rsneedAvail.Fields.Item("state").Value))) Then If ("" = CStr((rsneedAvail.Fields.Item("state").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>></option>
                  <%
While (NOT rsStates.EOF)
%>
                  <option value="<%=(rsStates.Fields.Item("stateCode").Value)%>" <%If (Not isNull((rsneedAvail.Fields.Item("state").Value))) Then If (CStr(rsStates.Fields.Item("stateCode").Value) = CStr((rsneedAvail.Fields.Item("state").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsStates.Fields.Item("stateName").Value)%></option>
                  <%
  rsStates.MoveNext()
Wend
If (rsStates.CursorType > 0) Then
  rsStates.MoveFirst
Else
  rsStates.Requery
End If
%>
                </select>
              </label>
              <br />
              <br />
              <label>Telephone#:
                <input name="phone" type="text" id="phone" tabindex="5" value="<%=(rsneedAvail.Fields.Item("phone").Value)%>" />
              </label>
              <br />
              <br />
              <label>Email:
                <input name="email" type="text" id="email" tabindex="6" value="<%=(rsneedAvail.Fields.Item("email").Value)%>" size="48" maxlength="48" />
              </label>
              <br />
              <br />
              <label>Additional Information:
                <input name="info" type="text" id="info" tabindex="7" value="<%=(rsneedAvail.Fields.Item("info").Value)%>" size="58" maxlength="255" />
              </label>
              <br />
              <br />
              <input type="submit" name="addButton" id="addButton" value="Update Me" tabindex="5" />
                 
              <input type="reset" name="reset" id="reset" value="Reset" />
            </fieldset>
            <input type="hidden" name="MM_update" value="needavailUpdate" />
            <input type="hidden" name="MM_recordId" value="<%= rsneedAvail.Fields.Item("recID").Value %>" />
            <input type="hidden" name="eventID" value="<%= rsneedAvail.Fields.Item("eventID").Value %>" />
          </form>
        </div>
      </div>
      <!-- InstanceEndEditable --></div>
  </div>
  <div id="clear"></div>
  <div id="footer">
    <p><u><a href="../../membership/joinRenew/membershipOptions.asp" class="ftrLinks">Membership</a></u> | <u><a href="eventSelect.asp" class="ftrLinks">Racing</a></u> | <u><a href="../../classRules/documents/ilcaBylaws.asp" class="ftrLinks">Class Rules</a></u> | <u><a href="../../photoGallery/photos2008/index.asp" class="ftrLinks">Photo Gallery</a></u> | <u class="ftrLinks"><a href="../../marketplace/store/index.asp">Marketplace</a></u> | <u><a href="../../contacts/index.asp" class="ftrLinks">Contacts</a></u> | <u class="ftrLinks"><a href="../../siteMap.asp">Site Map</a></u><br />
      All Rights Reserved—International Lightning Class Association<br />
      <u><a href="mailto:office@lightningclass.org" class="ftrLinks">office@lightningclass.org</a></u><br />
      1528 Big Bass Drive, Tarpon Springs, Florida  34689— Phone: 727-942-7969 — Fax: 727-942-0173 — Skype: ilcaoffice</p>
  </div>
</div>
</body>
<!-- InstanceEnd --></html>
<%
rsStates.Close()
Set rsStates = Nothing
%>
<%
rsneedavailReq.Close()
Set rsneedavailReq = Nothing
%>
<%
rsneedAvail.Close()
Set rsneedAvail = Nothing
%>

This topic has been closed for replies.

1 reply

Participating Frequently
June 11, 2011

1) You said you have an issue but did not tell us what it is.

2) You have posted too much code for us to sift through. I suggest recreating the problem on a simpler page if possible.

sherleonAuthor
Participating Frequently
June 12, 2011

Thank you for your attention and diligence. I know it was overwhelming. I've uploaded my new pages and found that they seem to be working as designed - whereas they weren't working totally correctly on localhost. I believe I'm good for now. If I run into more problems, I'll find a simpler way to present the problem. Thank you, again.

Lon_Winters
Inspiring
June 12, 2011

Thank you, again. I am using a confirmation page - and then redirecting back to the update page. That is why I was confused about the values not updating. But it appears to be working correctly on the active website. I will keep your response for future reference.


Then it's definitely a caching issue only with your local server, so you don't need to change anything on the page. I'm not a wizard with local testing environments, so I don't know if there are specific configuration settings that deal with this.