如题所述
VBscript常ç¨å½æ°
1.æ°å¼åå½æ°ï¼
abs(num): è¿åç»å¯¹å¼
sgn(num): num>0 1; num=0 0; num<0 -1;å¤ææ°å¼æ£è´
hex(num): è¿ååå è¿å¶å¼ ç´æ¥è¡¨ç¤ºï¼&Hxx æ大8ä½
oct(num): è¿åå «è¿å¶å¼ ç´æ¥è¡¨ç¤ºï¼&Oxx æ大8ä½
sqr(num): è¿åå¹³æ¹æ ¹ num>0
int(num): åæ´ int(99.8)=99; int(-99.2)=100
fix(num): åæ´ fix(99.8)=99; fix(-99.2)=99
round(num,n): åèäºå ¥åå°æ°ä½ round(3.14159,3)=3.142 ä¸ç¹æ°å¼åèäºå ¥ä¸ºè¿å¶åæ´ round(3.25,1)=3.2
log(num): å以e为åºçå¯¹æ° num>0
exp(n): åeçnæ¬¡å¹ éå¸¸ç¨ num^n
sin(num): ä¸è§å½æ°ï¼ä»¥å¼§åº¦ä¸ºå¼è®¡ç® (è§åº¦*Pai)/180=弧度 con(num); tan(num); atn(num)
2.å符串å½æ°ï¼
len(str)ï¼è®¡ç®å符串é¿åº¦ ä¸æå符é¿åº¦ä¹è®¡ä¸ºä¸ï¼
mid(str,èµ·å§å符,[读åé¿åº¦])ï¼æªåå符串ä¸é´åå符串
left(str,nlen)ï¼ä»å·¦è¾¹èµ·æªånlené¿åº¦åå符串
right(str,nlen)ï¼ä»å³è¾¹èµ·æªånlené¿åº¦åå符串
Lcase(str)ï¼å符串转æå°å
Ucase(str)ï¼å符串转æ大å
trim(str)ï¼å»é¤åç¬¦ä¸²ä¸¤ç«¯ç©ºæ ¼
Ltrim(str)ï¼å»é¤åç¬¦ä¸²å·¦ä¾§ç©ºæ ¼
Rtrim(str)ï¼å»é¤å符串å³ä¾§ç©ºæ ¼
replace(str,æ¥æ¾å符串,æ¿ä»£å符串,[èµ·å§å符,æ¿ä»£æ¬¡æ°,æ¯è¾æ¹æ³])ï¼æ¿æ¢å符串
注ï¼é»è®¤å¼ï¼èµ·å§å符 1ï¼æ¿ä»£æ¬¡æ° ä¸éï¼æ¯è¾æ¹æ³ åºå大å°åï¼0ï¼
InStr([èµ·å§å符,]str,æ¥æ¾å符串[,æ¯è¾æ¹æ³])ï¼æ£æµæ¯å¦å å«åå符串 å¯éåæ°éåæ¶é è¿åèµ·å§ä½ç½®
InStrRev(str,æ¥æ¾å符串[,èµ·å§å符][,æ¯è¾æ¹æ³])ï¼ååæ£æµæ¯å¦å å«åå符串 è¿åèµ·å§ä½ç½®
space(n)ï¼æé nä¸ªç©ºæ ¼çå符串
string(n,str)ï¼æé ç±n个str第ä¸ä¸ªå符ç»æçå符串
StrReverse(str)ï¼å转å符串
split(str,åå²å符串[,次æ°][,æ¯è¾æ¹æ³])ï¼ä»¥åå²å符串为åå²æ å¿å°å符串转为å符æ°ç» å¯éåæ°éåæ¶é
3.æ°æ®ç±»å转æ¢å½æ°ï¼
Cint(str)ï¼è½¬æ¢æ£æ° True -1ï¼False 0ï¼æ¥æ è·ç¦»1899/12/31天æ°ï¼æ¶é´ ä¸å段 0ï¼ä¸å段 1ï¼
Cstr(str)ï¼æ¥æ è¾åºæ ¼å¼ yyyy/mm/ddï¼æ¶é´ è¾åºæ ¼å¼ Am/Pm hh:mm:ss
Clng(str)ï¼ä¸Cin()类似
Cbool(num)ï¼numä¸ä¸ºé¶ Trueï¼åä¹ False
Cdate(str)ï¼è½¬æ¢æ¥ææ ¼å¼ 0ï¼#Am 12:00:00#ï¼æ£æ° è·ç¦»1899/12/31天æ°çæ¥æï¼æµ®ç¹æ° æ¥æï¼å°æ°æ¶é´
Cbyte(num)ï¼num<255 转æ¢ä¸ºåè
Csng(str)ï¼è½¬æ¢ä¸ºå精度æ°å¼
Cdbl(str)ï¼è½¬æ¢ä¸ºå精度æ°å¼
Ccur(str)ï¼è½¬æ¢ä¸ºç°éæ ¼å¼
4.æ¶é´å½æ°ï¼
dateï¼åç³»ç»å½åæ¥æ
timeï¼åç³»ç»å½åæ¶é´
nowï¼åç³»ç»å½åæ¶é´åæ¥æå¼ Datetimeç±»å
timerï¼åå½åæ¶é´è·ç¦»é¶ç¹ç§å¼ï¼è®¡æ¶å¨ï¼å¯è®¡ç®æ¶é´å·®
DateAdd(é´éåä½,é´éå¼,æ¥æ)ï¼æ¨ç®ç¸é»æ¥æ
DateDiff(é´éåä½,æ¥æä¸,æ¥æäº)ï¼è®¡ç®æ¶é´å·® æ¥æäº-æ¥æä¸
Datepart(é´éåä½,æ¥æ)ï¼è®¡ç®æ¥æçé´éåä½å¼
Dateserial(date)ï¼è¾åºæ¥æå¼ï¼æåºå计ç®ï¼
Timeserial(time)ï¼è¾åºæ¶é´å¼ï¼æåºå计ç®ï¼
DateValue(datetime)ï¼ååºå符串ä¸æ¥æå¼
Timevalue(datetime)ï¼ååºå符串ä¸æ¶é´å¼
weekday(date)ï¼è®¡ç®ææå
MonthName(date)ï¼è¾åºæåå
year(datetime)ï¼æªå年份
month(datetime)ï¼æªåæ份
day(datetime)ï¼æªåæ¥
hour(datetime)ï¼æªåå°æ¶
minute(datetime)ï¼æªååé
second(datetime)ï¼æªåç§
5.å ¶å®å½æ°ï¼
Array(unit,..)ï¼å¨æçææ°ç»
Asc(str)ï¼è¾åºå符串第ä¸ä¸ªå符çASCIIç
Chr(asc)ï¼è½¬æ¢ASCII为å符 Enterï¼Chr(13)&Chr(10)
Filter(æ°ç»å称,å ³é®å符串,[,å å«][,æ¯è¾æ¹æ³])ï¼
å°å符串æ°ç»ä¸å«æå ³é®å符串çå ç´ åææ°çæ°ç»ï¼é»è®¤ï¼ [å å«]为falseååä¸å å«çå ç´
Join(ArrayName)ï¼å°æ°ç»ä¸å ç´ è¿æå符串
Ubound(ArrayName[,ç»´æ°])ï¼åå¾æ°ç»ç¸åºç»´æ°çä¸ç
Lbound(ArrayName[,ç»´æ°])ï¼åå¾æ°ç»ç¸åºç»´æ°çä¸ç ä¸è¬ä¸º0
Randmize nï¼å¯å¨éæºæ°ç§å
Rnd(n)ï¼åå¾éæºæ°ï¼n>0æ为空ï¼ååºåä¸ä¸éæºå¼ï¼n<0ï¼éæºå¼ç¸åï¼n=0ï¼ç产ä¸ä¸ä¸éæºå¼ç¸åçæ°
åä»äºAåBä¹é´çéæºæ£æ°Cï¼å ¬å¼ï¼C=Int((B-A+1)*Rnd+A) æ¡ä»¶ï¼B>Aï¼
åç¨åºåèªå®ä¹å½æ°
Sub StrSubName Function StrFunName(arg[1],..)
åç¨åºä½ å½æ°ä½
Exit Sub ä¸éè·³åº Exit Function ä¸éè·³åº
End Sub StrFunNameï¼Value è¿åå¼
End Function
[call] StrSubName å¼ç¨åç¨åº Var=StrFunName(arg[1],..) å¼ç¨å½æ°
åç¨åºåèªå®ä¹å½æ°å¯ä»¥éå½è°ç¨ï¼
ASPå 大对象常ç¨è¯å¥ç¤ºèï¼
Responseï¼
Response.write StrVar/"String"ï¼åç½é¡µååºåæ°å¼æå符串 çåäºå¨Htmlæ è®°ä¸åµå ¥<%=StrVar/"String"%>
Response.Endï¼åæ¢é¡µé¢ç¼è¯ï¼å¹¶å°å·²ç»ç¼è¯å 容è¾åºå°æµè§å¨
Response.Buffer=True|Falseï¼é¡µé¢ç¼è¯æ¶æ¯å¦ä½¿ç¨ç¼åç设置ï¼ä¸è¬å¨é¡µé¢å¤´é¨è®¾ç½®
Response.Flushï¼å¼ºå¶è¾åºé¡µé¢å·²ç¼è¯é¨åå 容
Response.Clearï¼å°ç¼å²åºå çæ°æ®æ¸ é¤
Response.Redirect URLï¼åæ¢é¡µé¢ç¼è¯æè¾åºï¼è½¬è½½æå®æé页é¢
Response.IsClientConnectedï¼è¿åTrue|Falseï¼æ£æµç¨æ·æ¯å¦è¿å¤äºè¿æ¥ç¶æ
Response.Charset(CharsetName)ï¼è®¾ç½®é¡µé¢ç¼ç ç±»åï¼å³<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
Response.ContentType [= ContentType ]ï¼è®¾ç½®é¡µé¢æ件类åï¼åä¸
Response.Expires [= number]ï¼è®¾ç½®é¡µé¢å¤±ææ¶é´ï¼åä½åé
Response.ExpiresAbsolute [= [date] [time]]ï¼è®¾ç½®é¡µé¢å¤±æçç»å¯¹æ¶é´
Response.Status = StatusDescriptionï¼è®¾ç½®é¡µé¢ç¶ææè¿°
Requestï¼
Request("PassStrName")ï¼è¯»åç½é¡µä¼ éå¼ï¼å æ¬è¡¨åå以ï¼PassStrNameï¼value&PassStrName_nï¼value_nå½¢å¼
Request[.collection|property|method](variable)
Request.querystring("PassStrName")ï¼è¯»åGetæ¹æ³ä¼ éç表åå¼åï¼PassStrNameï¼value
Request.QueryString(Varible)[(Index).Count]
Request.form("PassStrName")ï¼è¯»åPostæ¹æ³ä¼ éç纯表ååçå¼
Request.Form(Parameter)[(Index).Count]
Request.ServerVaribles(Server Environment Variable)ï¼è¯»å客æ·ç«¯ç³»ç»ç¯å¢åéï¼è¯¦è§åè
Request.BinaryRead(Count)ï¼è¯»åæå®åèæ°çä¼ éå¼
Request.TotalBytesï¼æ¥è¯¢ä½çé¿åº¦ï¼ä»¥åè为åä½ï¼åªè¯»
注ï¼åå表åå¦ï¼CheckBoxå¦æå¤é¡¹å¼ï¼ä¼ éå½¢å¼å¦å³ï¼StrName=value1,value2,...éè¦ç¨Splitå½æ°åå²å项å¼
MultipleçSelect表åä¸CheckBox类似ï¼TextAreaçå¼å¯å å«æ¢è¡å符ï¼ç¨Replace转为<br>ï¼ä»¥æ»¡è¶³æ ¼å¼éè¦
Sessionï¼ï¼ç¨æ·å ¨å±åéï¼
Session("SesName")ï¼valueï¼åå¨Sessionåéå¼ï¼ä¹å¯è¯»å该å¼
Session("SesName")ï¼Emptyï¼å¤æSessionå¼æ¯å¦åå¨ç两ç§æ¹æ³
IsEmpty(Session("SesName"))=True|Falseï¼å¤æSessionå¼æ¯å¦åå¨ç两ç§æ¹æ³
Session.TimeOut=numï¼è®¾ç½®Sessionåéçåå¨æ¶æï¼åä½åé
Session.Abandonï¼æ¸ é¤ææSessionåéå¼
Session.SessionIDï¼SessionåéçIDåºåå·ï¼åªè¯»
Applicationï¼ï¼åºç¨ç¨åºå ¨å±åéï¼
Application("AppName")ï¼valueï¼åå¨Applicationåéå¼ï¼ä¹å¯è¯»å该å¼
Application("AppName")ï¼Emptyï¼å¤æApplicationå¼æ¯å¦åå¨ç两ç§æ¹æ³
IsEmpty(Application("AppName"))=True|Falseï¼å¤æApplicationå¼æ¯å¦åå¨ç两ç§æ¹æ³
Application.Lockï¼Applicationåéå¼éå®ï¼é²æ¢åæ¶æ´æ¹åéå¼
Application.UnLockï¼Applicationåéå¼è§£éï¼å 许æ´æ¹åéå¼
注ï¼Sessionä¸Applicationåéé½å¯ä»¥ç¨æ¥åå¨æ°ç»åç³»ç»å¯¹è±¡ï¼å¼ç¨æ¹æ³æ¯åéåç¸å½äºæ°ç»åèå·²ï¼
ä½ä¸è½ç´æ¥æ¹åå ¶å¼ï¼éè¦åå©ä¸´æ¶æ°ç»ä¿®æ¹å¼åï¼åèµç»Sessionä¸Applicationåé
Global.asaæ件çç»æï¼
<% @language="VBscript"%>
<% Sub Application_OnStart ...End Sub
Sub Application_OnEnd ... End Sub
Sub Session_OnStart ...End Sub
Sub Session_OnEnd ... End Sub%>
Server:
Server.MapPath("FileUrl")ï¼æ å°æ件åçæå¡å¨ç«ç¹ç»å¯¹å°åï¼Path=Server.MapPath(./)å¯ä»¥å¾å°èæç®å½æ ¹è·¯å¾
Server.HtmlEncode("string")ï¼è½¬æ¢ä¸ºå¯ä»¥ç´æ¥æ¾ç¤ºå¸¦Htmlæ ¼å¼çå符串ï¼å¦ï¼<,>ç
Server.URLEncode( "string")ï¼è½¬æ¢ä¸ºæµè§å¨å°åç¼ç
set Varï¼Server.CreatObject("ObjName")ï¼å建对象åé
Server.ScriptTimeout = NumSecondsï¼ASPç¨åºé¡µé¢æ§è¡æ¶éï¼ä»¥ç§ä¸ºåä½
Cookies: åå¨å¨ç¨æ·æ¬æºç临æ¶åéï¼æ¯ä¸ªCookieçæ大åè4KBï¼æå¤å¯ä»¥æ300个Cookie 1.2MB
Response.cookies("StrCookieName")ï¼valueï¼åå¨Cookieåéå¼ï¼ä¹å¯è¯»å该å¼
Response.cookies("StrCookieName")ï¼""ï¼å¤ææ¯å¦ä¸ºç©º
Response.cookies("StrCookieName").Expires=Dateï¼åéæææï¼ä»¥å¤©ä¸ºåä½ï¼å°äºå½åæ¶é´ç«å³å¤±æ
Response.Cookies(Cookie[(key).Attribute])ï¼æ åè¯æ³
ObjectContext æ§å¶ASPçäºå¡å¤ç
ObjectContext.OnTransactionAbortï¼ç±æ¾å¼çäºå¡å¤çäºä»¶æ¿åï¼å¨èæ¬å®æå¤çååç
ObjectContext.OnTransactionCommitï¼ç±æåçäºå¡å¤çäºä»¶æ¿åï¼å¨èæ¬å®æå¤çååç
ObjectContext.SetAbortï¼æ¾å¼çæ¾å¼ä¸æ¬¡äºå¡å¤ç
ObjectContext.SetCompleteï¼è¦çåé¢ä»»ä½è°ç¨ObjectContext.SetAbortæ¹æ³çè°ç¨
Msgbox "string"/StrNameï¼VBscriptæ示æ¡
表åçOnsubmitäºä»¶ï¼
å¨åä¸é¡µé¢åå ¥ Function FormName_onsubmit()..FormName_onsubmitï¼True/False..end Functionï¼
页é¢ä¼å¨æ交åå æ§è¡è¯å¥ï¼å¹¶æ ¹æ®è¿åå¼å¤ææ¯å¦å®ææ交任å¡ã
æ°æ®åºè¿æ¥å符串举ä¾ï¼
Access2000ï¼
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("dbase\liuyan.mdb")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("dbase\liuyan.mdb")&";Password=admin"
Recordset.Open "æ°æ®è¡¨å", conn, 2, 2
SqlServer2000ï¼
conn.Open "Provider=SQLOLEDB.1;User ID=sa;Password=admin;Initial Catalog=pubs;Data Source=server\garlmrm"
conn.Open "provider=SQLOLEDB;data source=hyserver;uid=sa;pwd=;database=pubs"
Recordset.Open StrSQL, conn, 2, 2
Dbaseï¼(?)
conn Open "Driver={Microsoft dBase Driver};SourceType=DB;SourceDB=" & Server.MapPath( "ç®å½å" )
Recordset.Open StrSQL, conn, 2, 2
FoxBaseï¼
conn Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" & Server.MapPath( "ç®å½å" )
Recordset.Open DBFæ件åæSelectè¯å¥, conn, 2, 2
conn Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=" & Server.MapPath( "DBCæ°æ®åºæ件å" )
Recordset.Open DBFæ件åæSelectè¯å¥, conn, 2, 2
Excelï¼
conn Open "Driver={Microsoft Excel Driver (*.xls)};DBQ=" & Server.MapPath( "XLSæ件å" )
Recordset.Open "Select * From ["&sheet&"$]",conn,2,2
注ï¼ä½¿ç¨DBFãDBCãExcelæ°æ®åºï¼ä¸é¢å ç¹è¦æ³¨æï¼Excelæ°æ®åºåªè½è¯»åãå¢å è®°å½ãä¿®æ¹è®°å½ï¼ä½ä¸è½å é¤è®°å½ï¼
DBFãDBCå¯ä»¥è¯»åè®°å½ãå¢å è®°å½ãå é¤è®°å½ãä¿®æ¹è®°å½ï¼ä½æ¯å¨å¢å è®°å½æ¶ï¼ä»»ä½ä¸ä¸ªå段å¼é½ä¸è½ä¸ºç©ºï¼ç±æ¤
å¯çåºå±éæ§å¾å¤§ï¼æ以尽å¯è½å°ç¨MDBæSQLæ°æ®åºã
1.æ°å¼åå½æ°ï¼
abs(num): è¿åç»å¯¹å¼
sgn(num): num>0 1; num=0 0; num<0 -1;å¤ææ°å¼æ£è´
hex(num): è¿ååå è¿å¶å¼ ç´æ¥è¡¨ç¤ºï¼&Hxx æ大8ä½
oct(num): è¿åå «è¿å¶å¼ ç´æ¥è¡¨ç¤ºï¼&Oxx æ大8ä½
sqr(num): è¿åå¹³æ¹æ ¹ num>0
int(num): åæ´ int(99.8)=99; int(-99.2)=100
fix(num): åæ´ fix(99.8)=99; fix(-99.2)=99
round(num,n): åèäºå ¥åå°æ°ä½ round(3.14159,3)=3.142 ä¸ç¹æ°å¼åèäºå ¥ä¸ºè¿å¶åæ´ round(3.25,1)=3.2
log(num): å以e为åºçå¯¹æ° num>0
exp(n): åeçnæ¬¡å¹ éå¸¸ç¨ num^n
sin(num): ä¸è§å½æ°ï¼ä»¥å¼§åº¦ä¸ºå¼è®¡ç® (è§åº¦*Pai)/180=弧度 con(num); tan(num); atn(num)
2.å符串å½æ°ï¼
len(str)ï¼è®¡ç®å符串é¿åº¦ ä¸æå符é¿åº¦ä¹è®¡ä¸ºä¸ï¼
mid(str,èµ·å§å符,[读åé¿åº¦])ï¼æªåå符串ä¸é´åå符串
left(str,nlen)ï¼ä»å·¦è¾¹èµ·æªånlené¿åº¦åå符串
right(str,nlen)ï¼ä»å³è¾¹èµ·æªånlené¿åº¦åå符串
Lcase(str)ï¼å符串转æå°å
Ucase(str)ï¼å符串转æ大å
trim(str)ï¼å»é¤åç¬¦ä¸²ä¸¤ç«¯ç©ºæ ¼
Ltrim(str)ï¼å»é¤åç¬¦ä¸²å·¦ä¾§ç©ºæ ¼
Rtrim(str)ï¼å»é¤å符串å³ä¾§ç©ºæ ¼
replace(str,æ¥æ¾å符串,æ¿ä»£å符串,[èµ·å§å符,æ¿ä»£æ¬¡æ°,æ¯è¾æ¹æ³])ï¼æ¿æ¢å符串
注ï¼é»è®¤å¼ï¼èµ·å§å符 1ï¼æ¿ä»£æ¬¡æ° ä¸éï¼æ¯è¾æ¹æ³ åºå大å°åï¼0ï¼
InStr([èµ·å§å符,]str,æ¥æ¾å符串[,æ¯è¾æ¹æ³])ï¼æ£æµæ¯å¦å å«åå符串 å¯éåæ°éåæ¶é è¿åèµ·å§ä½ç½®
InStrRev(str,æ¥æ¾å符串[,èµ·å§å符][,æ¯è¾æ¹æ³])ï¼ååæ£æµæ¯å¦å å«åå符串 è¿åèµ·å§ä½ç½®
space(n)ï¼æé nä¸ªç©ºæ ¼çå符串
string(n,str)ï¼æé ç±n个str第ä¸ä¸ªå符ç»æçå符串
StrReverse(str)ï¼å转å符串
split(str,åå²å符串[,次æ°][,æ¯è¾æ¹æ³])ï¼ä»¥åå²å符串为åå²æ å¿å°å符串转为å符æ°ç» å¯éåæ°éåæ¶é
3.æ°æ®ç±»å转æ¢å½æ°ï¼
Cint(str)ï¼è½¬æ¢æ£æ° True -1ï¼False 0ï¼æ¥æ è·ç¦»1899/12/31天æ°ï¼æ¶é´ ä¸å段 0ï¼ä¸å段 1ï¼
Cstr(str)ï¼æ¥æ è¾åºæ ¼å¼ yyyy/mm/ddï¼æ¶é´ è¾åºæ ¼å¼ Am/Pm hh:mm:ss
Clng(str)ï¼ä¸Cin()类似
Cbool(num)ï¼numä¸ä¸ºé¶ Trueï¼åä¹ False
Cdate(str)ï¼è½¬æ¢æ¥ææ ¼å¼ 0ï¼#Am 12:00:00#ï¼æ£æ° è·ç¦»1899/12/31天æ°çæ¥æï¼æµ®ç¹æ° æ¥æï¼å°æ°æ¶é´
Cbyte(num)ï¼num<255 转æ¢ä¸ºåè
Csng(str)ï¼è½¬æ¢ä¸ºå精度æ°å¼
Cdbl(str)ï¼è½¬æ¢ä¸ºå精度æ°å¼
Ccur(str)ï¼è½¬æ¢ä¸ºç°éæ ¼å¼
4.æ¶é´å½æ°ï¼
dateï¼åç³»ç»å½åæ¥æ
timeï¼åç³»ç»å½åæ¶é´
nowï¼åç³»ç»å½åæ¶é´åæ¥æå¼ Datetimeç±»å
timerï¼åå½åæ¶é´è·ç¦»é¶ç¹ç§å¼ï¼è®¡æ¶å¨ï¼å¯è®¡ç®æ¶é´å·®
DateAdd(é´éåä½,é´éå¼,æ¥æ)ï¼æ¨ç®ç¸é»æ¥æ
DateDiff(é´éåä½,æ¥æä¸,æ¥æäº)ï¼è®¡ç®æ¶é´å·® æ¥æäº-æ¥æä¸
Datepart(é´éåä½,æ¥æ)ï¼è®¡ç®æ¥æçé´éåä½å¼
Dateserial(date)ï¼è¾åºæ¥æå¼ï¼æåºå计ç®ï¼
Timeserial(time)ï¼è¾åºæ¶é´å¼ï¼æåºå计ç®ï¼
DateValue(datetime)ï¼ååºå符串ä¸æ¥æå¼
Timevalue(datetime)ï¼ååºå符串ä¸æ¶é´å¼
weekday(date)ï¼è®¡ç®ææå
MonthName(date)ï¼è¾åºæåå
year(datetime)ï¼æªå年份
month(datetime)ï¼æªåæ份
day(datetime)ï¼æªåæ¥
hour(datetime)ï¼æªåå°æ¶
minute(datetime)ï¼æªååé
second(datetime)ï¼æªåç§
5.å ¶å®å½æ°ï¼
Array(unit,..)ï¼å¨æçææ°ç»
Asc(str)ï¼è¾åºå符串第ä¸ä¸ªå符çASCIIç
Chr(asc)ï¼è½¬æ¢ASCII为å符 Enterï¼Chr(13)&Chr(10)
Filter(æ°ç»å称,å ³é®å符串,[,å å«][,æ¯è¾æ¹æ³])ï¼
å°å符串æ°ç»ä¸å«æå ³é®å符串çå ç´ åææ°çæ°ç»ï¼é»è®¤ï¼ [å å«]为falseååä¸å å«çå ç´
Join(ArrayName)ï¼å°æ°ç»ä¸å ç´ è¿æå符串
Ubound(ArrayName[,ç»´æ°])ï¼åå¾æ°ç»ç¸åºç»´æ°çä¸ç
Lbound(ArrayName[,ç»´æ°])ï¼åå¾æ°ç»ç¸åºç»´æ°çä¸ç ä¸è¬ä¸º0
Randmize nï¼å¯å¨éæºæ°ç§å
Rnd(n)ï¼åå¾éæºæ°ï¼n>0æ为空ï¼ååºåä¸ä¸éæºå¼ï¼n<0ï¼éæºå¼ç¸åï¼n=0ï¼ç产ä¸ä¸ä¸éæºå¼ç¸åçæ°
åä»äºAåBä¹é´çéæºæ£æ°Cï¼å ¬å¼ï¼C=Int((B-A+1)*Rnd+A) æ¡ä»¶ï¼B>Aï¼
åç¨åºåèªå®ä¹å½æ°
Sub StrSubName Function StrFunName(arg[1],..)
åç¨åºä½ å½æ°ä½
Exit Sub ä¸éè·³åº Exit Function ä¸éè·³åº
End Sub StrFunNameï¼Value è¿åå¼
End Function
[call] StrSubName å¼ç¨åç¨åº Var=StrFunName(arg[1],..) å¼ç¨å½æ°
åç¨åºåèªå®ä¹å½æ°å¯ä»¥éå½è°ç¨ï¼
ASPå 大对象常ç¨è¯å¥ç¤ºèï¼
Responseï¼
Response.write StrVar/"String"ï¼åç½é¡µååºåæ°å¼æå符串 çåäºå¨Htmlæ è®°ä¸åµå ¥<%=StrVar/"String"%>
Response.Endï¼åæ¢é¡µé¢ç¼è¯ï¼å¹¶å°å·²ç»ç¼è¯å 容è¾åºå°æµè§å¨
Response.Buffer=True|Falseï¼é¡µé¢ç¼è¯æ¶æ¯å¦ä½¿ç¨ç¼åç设置ï¼ä¸è¬å¨é¡µé¢å¤´é¨è®¾ç½®
Response.Flushï¼å¼ºå¶è¾åºé¡µé¢å·²ç¼è¯é¨åå 容
Response.Clearï¼å°ç¼å²åºå çæ°æ®æ¸ é¤
Response.Redirect URLï¼åæ¢é¡µé¢ç¼è¯æè¾åºï¼è½¬è½½æå®æé页é¢
Response.IsClientConnectedï¼è¿åTrue|Falseï¼æ£æµç¨æ·æ¯å¦è¿å¤äºè¿æ¥ç¶æ
Response.Charset(CharsetName)ï¼è®¾ç½®é¡µé¢ç¼ç ç±»åï¼å³<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
Response.ContentType [= ContentType ]ï¼è®¾ç½®é¡µé¢æ件类åï¼åä¸
Response.Expires [= number]ï¼è®¾ç½®é¡µé¢å¤±ææ¶é´ï¼åä½åé
Response.ExpiresAbsolute [= [date] [time]]ï¼è®¾ç½®é¡µé¢å¤±æçç»å¯¹æ¶é´
Response.Status = StatusDescriptionï¼è®¾ç½®é¡µé¢ç¶ææè¿°
Requestï¼
Request("PassStrName")ï¼è¯»åç½é¡µä¼ éå¼ï¼å æ¬è¡¨åå以ï¼PassStrNameï¼value&PassStrName_nï¼value_nå½¢å¼
Request[.collection|property|method](variable)
Request.querystring("PassStrName")ï¼è¯»åGetæ¹æ³ä¼ éç表åå¼åï¼PassStrNameï¼value
Request.QueryString(Varible)[(Index).Count]
Request.form("PassStrName")ï¼è¯»åPostæ¹æ³ä¼ éç纯表ååçå¼
Request.Form(Parameter)[(Index).Count]
Request.ServerVaribles(Server Environment Variable)ï¼è¯»å客æ·ç«¯ç³»ç»ç¯å¢åéï¼è¯¦è§åè
Request.BinaryRead(Count)ï¼è¯»åæå®åèæ°çä¼ éå¼
Request.TotalBytesï¼æ¥è¯¢ä½çé¿åº¦ï¼ä»¥åè为åä½ï¼åªè¯»
注ï¼åå表åå¦ï¼CheckBoxå¦æå¤é¡¹å¼ï¼ä¼ éå½¢å¼å¦å³ï¼StrName=value1,value2,...éè¦ç¨Splitå½æ°åå²å项å¼
MultipleçSelect表åä¸CheckBox类似ï¼TextAreaçå¼å¯å å«æ¢è¡å符ï¼ç¨Replace转为<br>ï¼ä»¥æ»¡è¶³æ ¼å¼éè¦
Sessionï¼ï¼ç¨æ·å ¨å±åéï¼
Session("SesName")ï¼valueï¼åå¨Sessionåéå¼ï¼ä¹å¯è¯»å该å¼
Session("SesName")ï¼Emptyï¼å¤æSessionå¼æ¯å¦åå¨ç两ç§æ¹æ³
IsEmpty(Session("SesName"))=True|Falseï¼å¤æSessionå¼æ¯å¦åå¨ç两ç§æ¹æ³
Session.TimeOut=numï¼è®¾ç½®Sessionåéçåå¨æ¶æï¼åä½åé
Session.Abandonï¼æ¸ é¤ææSessionåéå¼
Session.SessionIDï¼SessionåéçIDåºåå·ï¼åªè¯»
Applicationï¼ï¼åºç¨ç¨åºå ¨å±åéï¼
Application("AppName")ï¼valueï¼åå¨Applicationåéå¼ï¼ä¹å¯è¯»å该å¼
Application("AppName")ï¼Emptyï¼å¤æApplicationå¼æ¯å¦åå¨ç两ç§æ¹æ³
IsEmpty(Application("AppName"))=True|Falseï¼å¤æApplicationå¼æ¯å¦åå¨ç两ç§æ¹æ³
Application.Lockï¼Applicationåéå¼éå®ï¼é²æ¢åæ¶æ´æ¹åéå¼
Application.UnLockï¼Applicationåéå¼è§£éï¼å 许æ´æ¹åéå¼
注ï¼Sessionä¸Applicationåéé½å¯ä»¥ç¨æ¥åå¨æ°ç»åç³»ç»å¯¹è±¡ï¼å¼ç¨æ¹æ³æ¯åéåç¸å½äºæ°ç»åèå·²ï¼
ä½ä¸è½ç´æ¥æ¹åå ¶å¼ï¼éè¦åå©ä¸´æ¶æ°ç»ä¿®æ¹å¼åï¼åèµç»Sessionä¸Applicationåé
Global.asaæ件çç»æï¼
<% @language="VBscript"%>
<% Sub Application_OnStart ...End Sub
Sub Application_OnEnd ... End Sub
Sub Session_OnStart ...End Sub
Sub Session_OnEnd ... End Sub%>
Server:
Server.MapPath("FileUrl")ï¼æ å°æ件åçæå¡å¨ç«ç¹ç»å¯¹å°åï¼Path=Server.MapPath(./)å¯ä»¥å¾å°èæç®å½æ ¹è·¯å¾
Server.HtmlEncode("string")ï¼è½¬æ¢ä¸ºå¯ä»¥ç´æ¥æ¾ç¤ºå¸¦Htmlæ ¼å¼çå符串ï¼å¦ï¼<,>ç
Server.URLEncode( "string")ï¼è½¬æ¢ä¸ºæµè§å¨å°åç¼ç
set Varï¼Server.CreatObject("ObjName")ï¼å建对象åé
Server.ScriptTimeout = NumSecondsï¼ASPç¨åºé¡µé¢æ§è¡æ¶éï¼ä»¥ç§ä¸ºåä½
Cookies: åå¨å¨ç¨æ·æ¬æºç临æ¶åéï¼æ¯ä¸ªCookieçæ大åè4KBï¼æå¤å¯ä»¥æ300个Cookie 1.2MB
Response.cookies("StrCookieName")ï¼valueï¼åå¨Cookieåéå¼ï¼ä¹å¯è¯»å该å¼
Response.cookies("StrCookieName")ï¼""ï¼å¤ææ¯å¦ä¸ºç©º
Response.cookies("StrCookieName").Expires=Dateï¼åéæææï¼ä»¥å¤©ä¸ºåä½ï¼å°äºå½åæ¶é´ç«å³å¤±æ
Response.Cookies(Cookie[(key).Attribute])ï¼æ åè¯æ³
ObjectContext æ§å¶ASPçäºå¡å¤ç
ObjectContext.OnTransactionAbortï¼ç±æ¾å¼çäºå¡å¤çäºä»¶æ¿åï¼å¨èæ¬å®æå¤çååç
ObjectContext.OnTransactionCommitï¼ç±æåçäºå¡å¤çäºä»¶æ¿åï¼å¨èæ¬å®æå¤çååç
ObjectContext.SetAbortï¼æ¾å¼çæ¾å¼ä¸æ¬¡äºå¡å¤ç
ObjectContext.SetCompleteï¼è¦çåé¢ä»»ä½è°ç¨ObjectContext.SetAbortæ¹æ³çè°ç¨
Msgbox "string"/StrNameï¼VBscriptæ示æ¡
表åçOnsubmitäºä»¶ï¼
å¨åä¸é¡µé¢åå ¥ Function FormName_onsubmit()..FormName_onsubmitï¼True/False..end Functionï¼
页é¢ä¼å¨æ交åå æ§è¡è¯å¥ï¼å¹¶æ ¹æ®è¿åå¼å¤ææ¯å¦å®ææ交任å¡ã
æ°æ®åºè¿æ¥å符串举ä¾ï¼
Access2000ï¼
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("dbase\liuyan.mdb")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("dbase\liuyan.mdb")&";Password=admin"
Recordset.Open "æ°æ®è¡¨å", conn, 2, 2
SqlServer2000ï¼
conn.Open "Provider=SQLOLEDB.1;User ID=sa;Password=admin;Initial Catalog=pubs;Data Source=server\garlmrm"
conn.Open "provider=SQLOLEDB;data source=hyserver;uid=sa;pwd=;database=pubs"
Recordset.Open StrSQL, conn, 2, 2
Dbaseï¼(?)
conn Open "Driver={Microsoft dBase Driver};SourceType=DB;SourceDB=" & Server.MapPath( "ç®å½å" )
Recordset.Open StrSQL, conn, 2, 2
FoxBaseï¼
conn Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" & Server.MapPath( "ç®å½å" )
Recordset.Open DBFæ件åæSelectè¯å¥, conn, 2, 2
conn Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=" & Server.MapPath( "DBCæ°æ®åºæ件å" )
Recordset.Open DBFæ件åæSelectè¯å¥, conn, 2, 2
Excelï¼
conn Open "Driver={Microsoft Excel Driver (*.xls)};DBQ=" & Server.MapPath( "XLSæ件å" )
Recordset.Open "Select * From ["&sheet&"$]",conn,2,2
注ï¼ä½¿ç¨DBFãDBCãExcelæ°æ®åºï¼ä¸é¢å ç¹è¦æ³¨æï¼Excelæ°æ®åºåªè½è¯»åãå¢å è®°å½ãä¿®æ¹è®°å½ï¼ä½ä¸è½å é¤è®°å½ï¼
DBFãDBCå¯ä»¥è¯»åè®°å½ãå¢å è®°å½ãå é¤è®°å½ãä¿®æ¹è®°å½ï¼ä½æ¯å¨å¢å è®°å½æ¶ï¼ä»»ä½ä¸ä¸ªå段å¼é½ä¸è½ä¸ºç©ºï¼ç±æ¤
å¯çåºå±éæ§å¾å¤§ï¼æ以尽å¯è½å°ç¨MDBæSQLæ°æ®åºã
温馨提示:答案为网友推荐,仅供参考