PC6下载站
PC6下载站
●
分类
分类
首页
软件
网游
专题
资讯
厂商
礼包
手游库
软件库
排行榜
如何从数据库得到一个列表表单
关注+
2004-11-07
作者:蓝点
ASPHole - Fill List Box Example
Country:
<%
' Construct path to database
sPath = Request.ServerVariables("Path_Translated")
sPath = Left(sPath,InStrRev(sPath,"\")) & "Countries.mdb"
'
' Open Connection & Recordset
set oSample = Server.CreateObject("ADODB.Connection")
oSample.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=TRUE;" & _
"Data Source=" & sPath, "Admin", ""
'
' Check for default...
mCountry = Trim(Request("Country"))
'
' Create the List
Set oRS=oSample.Execute _
("SELECT ID,COUNTRY " & _
"FROM COUNTRIES " & _
"ORDER BY ID")
DO WHILE NOT oRS.EOF
mSelected = ""
IF mCountry=trim(oRS("Country")) then mSelected=" SELECTED"
%>
><%=oRS("Country")%>
<%
oRS.MoveNext
Loop
%>