要使用ASP來讀取數據庫并將其值賦給下拉框,需要執行以下步驟:
Dim connStr
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\your_database_path\your_database_name.mdb"
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connStr
Dim sql
sql = "SELECT * FROM your_table_name"
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn
<select>
<% Do While Not rs.EOF %>
<option value="<%= rs("column_name") %>"><%= rs("column_name") %></option>
<% rs.MoveNext %>
<% Loop %>
</select>
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
以上代碼示例了如何讀取數據庫并將其值賦給下拉框。請根據你的實際情況修改數據庫路徑、表名、列名等信息。