Solved

Populate Dynamic DropDown

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now