当前位置: 首页 > 网络学院 > 服务端脚本教程 > ASP > ASP Create对象 方法

ASP
ASP 介绍
ASP Install
ASP 语法
ASP 变量
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa
ASP Send e-mail
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
ASP FileSystem
ASP TextStream

ASP Create对象 方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 358 ::
收藏到网摘: n/a

The CreateObject method creates an instance of an object. 
CreateObject方法的作用是创建一个对象实体。

Note: Objects created with this method have page scope. They are destroyed when the server are finished processing the current ASP page. To create an object with session or application scope, you can either use the <object> tag in the Global.asa file, or store the object in a session or application variable.
注意:用这种方法创建的对象存在一个可使用的页面范围要求。当服务器终止执行当前的ASP页面时,他们将被废弃;你可以在Global.asa文件中使用<object>标签在session或application范围内建立一个对象,或者将对象存储在session或者application变量中。

Syntax
语法

Server.CreateObject(progID)

Part
角色
Description
描述
progID Required. The type of object to create
必要的。用于描述所建立对象的类型

Example
举例

Example 1

This example creates an instance of the server component MSWC.AdRotator:

<%
Set adrot=Server.CreateObject("MSWC.AdRotator")
%>

Example 2

An object stored in a session variable is destroyed when the session ends. However, you can also destroy the object by setting the variable to Nothing or to a new value:

<%
Session("ad")=Nothing
%>
or
<%
Session("ad")="a new value"
%>

Example 3

You cannot create an instance of an object with the same name as a built-in object:

<%
Set Application=Server.CreateObject("Application")
%>

评论 (0) All

登陆 | 还没注册?