Solved

Populate Dynamic DropDown

Posted on 2004-09-29
3
597 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 125 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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/…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 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