ASP函数大全
ASP函数与VBSCRIPT类似,以下举一些常用的函数
Array()
函数返回一个数组
表达式 Array(list)
允许数据类型: 字符,数字均可
实例: <%
Dim myArray()
For i = 1 to 7
Redim Preserve myArray(i)
myArray(i) = WeekdayName(i)
Next
%>
返回结果: 建立了一个包含7个元素的数组myArray
myArray("Sunday","Monday", ... ... "Saturday"
CInt()
函数将一个表达式转化为数字类型
表达式 CInt(expression)
允许数据类型: 任何有效的字符均可
实例: <%
f = "234"
response.write cINT(f) + 2
%>
返回结果: 236
转化字符"234"为数字"234",如果字符串为空,则返回0值
CreateObject()
函数建立和返回一个已注册的ACTIVEX组件的实例。
表达式 CreateObject(objName)
允许数据类型: objName 是任何一个有效、已注册的ACTIVEX组件的名字.
实例: <%
Set con = Server.CreateObject("ADODB.Connection"
%>
CStr()
函数转化一个表达式为字符串.
表达式 CStr(expression)
允许数据类型: expression 是任何有效的表达式。
实例: <%
s = 3 + 2
response.write "The 返回结果 is: " & cStr(s)
%>
返回结果: 转化数字“5”为字符“5”。
Date()
函数返回当前系统日期.
表达式 Date()
允许数据类型: None.
实例: <%=Date%>
返回结果: 9/9/00
DateAdd()
函数返回一个被改变了的日期。
表达式 DateAdd(timeinterval,number,date)
允许数据类型:
timeinterval is the time interval to add;
number is amount of time intervals to add;
and date is the starting date.
实例: <%
currentDate = #9/9/00#
newDate = DateAdd("m",3,currentDate)
response.write newDate
%>
<%
currentDate = #12:34:45 PM#
newDate = DateAdd("h",3,currentDate)
response.write newDate
%>
相关文档:
<%
Call RemoveAllCache()
Sub RemoveAllCache()
Dim cachelist,i
Call InnerHtml("UpdateInfo","<b>开始执行清理当前站点缓存</b>:")
Cachelist=split(GetallCache(),",")
If UBound(cachelist)>1 Then
For i=0 to UBound(cachelist)-1
DelCahe Cachelist(i)
Call InnerHtml("UpdateInf ......
动态网页开发——ASP连接SQL2005数据库
说明:a、以下字符中数据库名forum,数据库服务器名WWW-2443D34E558\SQL2005(或者127.0.0.1)
b、查看sql数据库服务器名称:对象资源管理器->数据库->右键点击自己建的数据库->属性->权限
c、Provider=sqlncli也可以,UID与“=”之间不可以 ......
ASP通过cookie实现自动记住密码的功能
把以下代码加入验证页:
<%if Trim(Cstr(request.QueryString("check")))="true" then ‘用来判断是否有选择记住密码
Response.Cookies("UserCookie")("username") = Trim(Cstr(request.Form("username")))
Response.Cookies("UserCookie")("passwords") = trim ......
指针在C中经常提到,但是任何一种语言中都隐藏着指针。
asp也是如此,在我们传递参数给function或者sub时,我们如果传递的是一个变量,那么asp会把这个变量地址传过去,所以如果你在函数和过程里面更改这个参数,那么原变量也会改变。
'函数例子
Dim i1,i2
i1=1
'=======================
Function toadd(i)'或 ......
1.放注入函数
sub aspsql()
SQL_injdata = "'|;|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
SQL_inj = split(SQL_Injdata,"|")
If Request.Form<>"" Then
For Each Sql_Post In Request.Form
For SQL_Data=0 To Ubound(SQL_inj)
if instr(Request.Form(Sql_Post) ......