Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 940611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:59:06+00:00 2026-05-15T21:59:06+00:00

This is related to Classic ASP code. A page fetches data for a particular

  • 0

This is related to Classic ASP code.
A page fetches data for a particular ProjectCode.

There is a general text field which shows the Site-Location for selected Project-Code. I want to change it to drop down, so that a user can change the Site-Location from options available (fetched from DB) and then save it. Also, on page load the Site-Location of Project-Code for that particular entry should be selected.

I have added following code to my Page, but it doesn’t work(definately I am new to classic ASP).

    strSQL = "SP_GET_SiteLocation"
    Set rsSiteList = RunSQLQuery(strSQL)

    'show the list
    If Not rsSiteList.EOF Then
    Do While NOT rs.EOF
    SiteLocationList= SiteLocationList & "<option value="">" & rs("LOCATION") & "</option>"
    rs.MoveNext 

Also, on click of save button, i have to send the selected drop down value to update query.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:59:07+00:00Added an answer on May 15, 2026 at 9:59 pm

    You use a wrong name for the recordset variable..

    You named it rsSiteList but you use it as rs

    Do While NOT rsSiteList.EOF
        SiteLocationList= SiteLocationList & "<option value="">" & rsSiteList("LOCATION") & "</option>"
        rsSiteList.MoveNext 
    

    Update

    You are building a string with all the options ..

    you should write it in the page at some point.. response.write(SiteLocationList)

    or write the <options> directly to the page..

    <select name="somename"><%
        Do While NOT rsSiteList.EOF
       %>
           <option value=""><%=rsSiteList("LOCATION")%></option>
       <%
             rsSiteList.MoveNext 
         Loop
       %>
    </select>
    

    update 2

    Not sure why you do not want to print the options as you read them from the recordset but prefer to make a huge string instead and print that at the end … it is the same thing but much more cleaner ..

    The following should select the location that matches the rsReqDetails(“AppReqSiteID”)

    <td>
    <%
      strSQL="SP_EPAPM_GET_SiteLocation"
      Set rsSiteList=RunSQLQuery(strSQL)
      selectedValue = rsReqDetails("AppReqSiteID")
      If Not rsSiteList.EOF Then
        Do While NOT rsSiteList.EOF
           loc = rsSiteList("LOCATION")
           if loc <> selectedValue then
             optionOpen = "<option>"
           else
             optionOpen = "<option selected=""selected"">"
           end if
           optionClose = "</option>"
           SiteLocationList=SiteLocationList & optionOpen  & rsSiteList("LOCATION") & optionClose 
          rsSiteList.MoveNext 
        Loop
      End If
      %>
      <select id="SiteLocationList" NAME="SiteLocationList">
        <%response.write(SiteLocationList)%>
      </select>
    </td>
    

    In general you need to watch the nesting of html as it can mess everything up. Also you need to read a little on the interactions between ASP and HTML …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is related to another open question of mine . While there aren't any
(This is classic ASP) I'm sure this is just a case of escaping the
Classic ASP, VBScript context. A lot of articles including this Microsoft one , say
I'm developing a ASP.NET MVC application with 3 layer classic architecture 1. data access
I have a form which allows to view data in a page or download
We have an ASP Classic website running on Windows Server 2003 and IIS6 which
This question is an extension of this Related question . Taking Derick's advice, I
I found this related question: How do I use composition with inheritance? I would
I have searched here, GooBingHooVista'd the world and read this related question for VS
This is related to this question but with a different take. In Ubuntu, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.