Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Populate Dynamic DropDown

Posted on 2004-09-29
3
Medium Priority
?
599 Views
Last Modified: 2008-03-10
I wanted to dynamically populate a drop down box.. I found this code on the net and tried to edit it but apparently it doesnt work. I get an error in IE:

"Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/iishelp/iis/htm/tutorial/sim.asp, line 39, column 78
objConn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & strDBLocation"
-----------------------------------------------------------------------------^"

Can someone help me with this code or specify a place where i can find help
help wil be appreciated..

<%
Option Explicit

 Dim objConn
 Dim objRS
 Dim strSQL
 Dim appID
 Dim appName
 
 Const adOpenForwardOnly = 0
 Const adLockReadOnly  = 1
 
 strDBVirtualPath = "/iishelp/iis/htm/tutorial/Simulation.mdb"
 strDBLocation = Server.Mappath(strDBVirtualPath)

 Set objConn = Server.CreateObject("ADODB.Connection")
 Set objRS  = Server.CreateObject("ADODB.Recordset")

 objConn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & strDBLocation"

 strSQL = "SELECT Application_ID, Application FROM Application"
 
 objRS.Open strSQL, objConn, adOpenForwardOnly, adLockReadOnly
 
 Response.Write "<SELECT Name=""AppID"">"
 Response.Write "<OPTION Value=""""></OPTION>"
 
 ' Loop through the recordset and populate the dropdown
 Do Until objRS.EOF = True
  AppID  = objRS("AppID").Value
  UserName = objRS("Application").Value

   Response.Write "<OPTION Value=""" & AppID & """>"
   Response.Write Application
   Response.Write "</OPTION>"
 
 objRS.Movenext
 Loop
 
 Response.Write "</SELECT>"
 
 objRS.Close
 Set objRS = Nothing
 Set objConn = Nothing
%>
0
Comment
Question by:apoorvamehta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Accepted Solution

by:
dfu23 earned 500 total points
ID: 12180674
kill the last double quote on that line, like this:

objConn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & strDBLocation
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question