Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

ASP CreateObject 方法


❮ 完整服务器对象参考

CreateObject 方法创建对象的实例。

注意:使用此方法创建的对象具有页面范围。当服务器完成处理当前 ASP 页面时,它们将被销毁。要创建具有会话或应用程序范围的对象,可以使用 Global.asa 文件中的 <object> 标签,或者将对象存储在会话或应用程序变量中。

语法

Server.CreateObject(progID)

部分 描述
progID 必需。要创建的对象类型

示例 1

此示例创建服务器组件 MSWC.AdRotator 的实例

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

示例 2

存储在会话变量中的对象在会话结束时将被销毁。但是,您也可以通过将变量设置为 Nothing 或新值来销毁该对象。

<%
Session("ad")=Nothing
%>



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

示例 3

您不能创建与内置对象同名的对象的实例

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

❮ 完整服务器对象参考
×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.