<%
' Create the Command to start your SQL and then your RecordSet (rsDD)
Set sqlDD = Server.CreateObject("ADODB.Command")
sqlDD.ActiveConnection=objConn
sqlDD.Prepared = true
sqlDD.commandtext="SELECT ddid, ddname from DropDown."setrsDD = sqlDD.execute
%>
<!--#include file="ACN.asp"-->
<!--#include file="Header.asp"-->
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ASP Classic SQL Server Database Driven Dropdown Menu</title>
</head>
<body>
<strong>ASP Classic SQL Server Database Driven Dropdown Menu</strong><br />
This demonstration loads all values from a database table into a Select Menu.<br />
<select>
<option value="0">Choose</option>
<%Ifrsdd.EOFThenresponse.write"Sorry, there are no records in our Database."else
arrdd = rsdd.GetRows() ' Loads data into an array
End Ifrsdd.close
setrsdd = nothing
If IsArray(arrdd) Then
For dd = 0 To UBound(arrdd, 2)
id = arrdd(0,dd)
ddName = arrdd(1,dd)%>
<option value="<%=id%>"><%=ddName%></option>
<%next
end if
objConn.close
set objConn = Nothing%>
</select>
</body>
</html>