国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

如何從數據庫得到一個列表表單

2019-11-18 21:41:52
字體:
來源:轉載
供稿:網友
<HEAD>
<TITLE>aspHole - Fill List Box Example</TITLE>
</HEAD>
<BODY>
<FORM METHOD=POST>
Country: <SELECT NAME="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"
%>
<OPTION<%=mSelected%>><%=oRS("Country")%></OPTION>
<%
oRS.MoveNext
Loop
%>
</SELECT><BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>



Key points of the sample:

sPath is used to construct the path to the database based on the home directory of the script. This means
that the database must be in the same directory as the script., otherwise, set sPath to the absolute path
of the database.

The database is assumed to a be an access 2000 Database with a table Countries with a character field
Country.

Forms are assumed to point at the same script which created it unless action is specified.

The IF mCountry=... statement is used to insert the Word SELECTED into the OPTION containing the previous
country value, should one have been passed in by a submit.

If you have problems running this script, your database drivers may be out of date. Go to
http://www.microsoft.com/data for the current MDAC RTM.

-END-



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 无极县| 玛多县| 大名县| 兴文县| 商洛市| 蓝山县| 定兴县| 彰化县| 渝中区| 沙坪坝区| 柞水县| 桂林市| 乌鲁木齐市| 建宁县| 北宁市| 长子县| 深水埗区| 十堰市| 东乌珠穆沁旗| 泌阳县| 马山县| 大城县| 济南市| 锦屏县| 清涧县| 定日县| 二手房| 辽阳市| 尼勒克县| 即墨市| 蓝田县| 咸丰县| 湖北省| 秦皇岛市| 武宣县| 大丰市| 兴山县| 大足县| 株洲县| 六盘水市| 洛浦县|