With the following code I get an HTTP 500 error. What am I missing, please? I have the connection and it test o.k. with a simple Select * query. I am trying to populate a dropdown box from an Access table.
Also, I would like to purchase an ASP 'toolkit' with fiffernet ASP form components. Any suggestions on a good source will be appreciated. Thanks for any help.
Ken

<%@ Language=VBScript %>
<%Option explicit
Dim oRs, conn, connect, strSQL
set conn=server.CreateObject ("adodb.connection")
connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("courses.mdb") & ";Persist Security Info=False"
conn.Open connect
%>
<html>
<head>
<title>Example combo box</title>
<script language="javascript">
<!--
function dept_onchange(frmSelect) {
frmSelect.submit();
}
//-->
</script>
</head>
<body>
The following was selected : <%=Request.Form ("courses")%>
<form name="frmSelect" method="Post" action="select.asp">
<SELECT name=courses LANGUAGE=javascript onchange="return dept_onchange(frmSelect)">
<%
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT DISTINCT CourseName FROM tblCourses ORDER BY CourseName"
oRs.Open strSQL, conn

Do while not oRs.EOF
if Request.Form("courses") = oRs("CourseName") then 'if this is the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRS ("CourseName") & "' SELECTED>"
Response.Write oRs("CourseName") & "</Option>"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRs ("CourseName") & "'>"
Response.Write oRs("CourseName") & "</Option>"
oRs.MoveNext
end if
loop
%>
</SELECT>
</form>
</body>
</html>

what i see right now is

Security Info=False"

correct it to "False"
i'll check the whole code sometime later and sooner

This article has been dead for over six months. Start a new discussion instead.