ASP常用函数详解
Array()
FUNCTION: 返回一个数组
SYNTAX: Array(list)
ARGUMENTS: 字符,数字均可
EXAMPLE: <%
Dim myArray()
For i = 1 to 7
Redim Preserve myArray(i)
myArray(i) = WeekdayName(i)
Next
%[/IMG]
RESULT: 建立了一个包含7个元素的数组myArray
myArray("Sunday","Monday", ... ... "Saturday")
CInt()
FUNCTION: 将一个表达式转化为数字类型
SYNTAX: CInt(expression)
ARGUMENTS: 任何有效的字符均可
EXAMPLE: <%
f = "234"
response.write cINT(f) + 2
%[/IMG]
RESULT: 236
转化字符"234"为数字"234",如果字符串为空,则返回0值
CreateObject()
FUNCTION: 建立和返回一个已注册的ACTIVEX组件的实例。
SYNTAX: CreateObject(objName)
ARGUMENTS: objName 是任何一个有效、已注册的ACTIVEX组件的名字.
EXAMPLE: <%
Set con = Server.CreateObject("ADODB.Connection")
%[/IMG]
RESULT:
CStr()
FUNCTION: 转化一个表达式为字符串.
SYNTAX: CStr(expression)
ARGUMENTS: expression 是任何有效的表达式。
EXAMPLE: <%
s = 3 + 2
response.write "The result is: " & cStr(s)
%[/IMG]
RESULT: 转化数字“5”为字符“5”。
Date()
FUNCTION: 返回当前系统日期.
SYNTAX: Date()
ARGUMENTS: None.
EXAMPLE: <%=Date%[/IMG]
RESULT: 8/4/99
DateAdd()
FUNCTION: 返回一个被改变了的日期。
SYNTAX: DateAdd(timeinterval,number,date)
ARGUMENTS: timeinterval is the time interval to add; number is amount of time intervals to add; and date is the starting date.
EXAMPLE: <%
currentDate = #8/4/99#
newDate = DateAdd("m",3,currentDate)
response.write newDate
%[/IMG]
<%
currentDate = #12:34:45 PM#
newDate = DateAdd("h",3,currentDate)
response.write newDate
%[/IMG]
RESULT: 11/4/99
3:34:45 PM
"m" = "month";
"d" = "day";
If currentDate is in time format then,
"h" = "hour";
相关文档:
'显示"上一页 下一页":链接地址,总数,页数,是否显示总数,是否用下拉列表跳转,单位
Public Function PageControl(iCount,pagecount,page,table_style,font_style,colspan)
'生成上一页下一页链接
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request. ......
<%
Dim Conn, Connstr
Dim strServer, strUid, strPwd, strDB
strServer = "HUA-5780C2D1CCF" 'SQL数据库服务器地址
strUid = "sa" '数据库用户名
strPwd = "123456" ......
1.Controller类引用的View会自动的对应到Views\XXX目录中寻找。
其中Views\Shared存放共享的试图模板。
搜索顺序:
首先搜索\Views\[Controller],如果找不到,再开始查找Views\Shared子目录。
2.
建议:视图的模板名称和Action引用的方法名称相同。
这样的话,开发人员就可以省略View Template的名称。
比如:retur ......
'判断是否是数字(包括整数和浮点数)
function IsNumber(str)
if RegPatrn("^-?[1-9]\d*$",str) or RegPatrn("^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$",str) then
IsNumber=true
else
IsNumber=false
end if
end function
'正则表达式判断是否匹配
Function RegPatrn(patrn, strng)
RegPatrn = false
Di ......
ASP与ActiveX控件交互实战(一)
关键字:ASP,ActiveX控件,数字签名,安全
ActiveX控件运行在客户端。我们可以获得客户端的一些信息,如IC卡的信息,客户端的验证等等。但是ActiveX控件也有许多缺点:客户端的部署很困难,如客户端不能正确下载,下载了 ......