|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ASP脚本是采用明文(plaintext)方式来编写的。<HEAD>
<TITLE>ASPHole-FillListBoxExample</TITLE>
</HEAD>
<BODY>
<FORMMETHOD=POST>
Country:<SELECTNAME="Country">
<%
Constructpathtodatabase
sPath=Request.ServerVariables("Path_Translated")
sPath=Left(sPath,InStrRev(sPath,""))&"Countries.mdb"
OpenConnection&Recordset
setoSample=Server.CreateObject("ADODB.Connection")
oSample.Open_
"Provider=Microsoft.Jet.OLEDB.4.0;"&_
"PersistSecurityInfo=TRUE;"&_
"DataSource="&sPath,"Admin",""
Checkfordefault...
mCountry=Trim(Request("Country"))
CreatetheList
SetoRS=oSample.Execute_
("SELECTID,COUNTRY"&_
"FROMCOUNTRIES"&_
"ORDERBYID")
DOWHILENOToRS.EOF
mSelected=""
IFmCountry=trim(oRS("Country"))thenmSelected="SELECTED"
%>
<OPTION<%=mSelected%>><%=oRS("Country")%></OPTION>
<%
oRS.MoveNext
Loop
%>
</SELECT><BR>
<INPUTTYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
Keypointsofthesample:
sPathisusedtoconstructthepathtothedatabasebasedonthehomedirectoryofthescript.Thismeans
thatthedatabasemustbeinthesamedirectoryasthescript.,otherwise,setsPathtotheabsolutepath
ofthedatabase.
ThedatabaseisassumedtoabeanAccess2000DatabasewithatableCountrieswithacharacterfield
Country.
Formsareassumedtopointatthesamescriptwhichcreateditunlessactionisspecified.
TheIFmCountry=...statementisusedtoinsertthewordSELECTEDintotheOPTIONcontainingtheprevious
countryvalue,shouldonehavebeenpassedinbyasubmit.
Ifyouhaveproblemsrunningthisscript,yourdatabasedriversmaybeoutofdate.Goto
http://www.microsoft.com/dataforthecurrentMDACRTM.
-END-
对用户来说可预见费用、节约费用,可以做到花少钱办大事。由于省去了购买软件和硬件等的前期费用,用户可以租用较高级的应用软件。ASP的收费是根据软件的类型、客制化程度、用户数量、服务期限来定的,对客户来说这笔费用是可以预见的。方便于客户应用软件的升级。 |
|