Solved

Populate Dynamic DropDown

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Index on a Table 6 36
Multiflying 2 Input Text On a Table 7 35
Use Mid in Html 6 34
ms sql and asp dates 5 41
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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/…

739 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