ASP Contents စုစည်း

Application 对象参考手册

Contents စုစည်းဟာ application/session သို့ အခြေခံ အမှုဥပဒေဖြင့် ထပ်ထည့်သွားသော အကိုင်းအလဲအား ပါဝင်သည်

အကြောင်းအရာ:Contents စုစည်းမှ အကိုင်းအလဲကို ဖယ်ရှားရန် သုံးပါ Remove နှင့် RemoveAll စနစ်ကို

ပြောဉ်

Application.Contents(Key)
Session.Contents(Key)
ပါဝင်သည် သင်္ချာ
key လိုချင်သော အကိုင်းအလဲ၏ အမည်ကို ရယူရန် လိုအပ်သည်。

Application အပေါင်းအချုပ် အတွက်

အမှတ် 1

သတိပြုပါ၊ name နှင့် objtest ဟာ Contents စုစည်းသို့ ထပ်ထည့်ရမည်ဖြစ်ပါသည်:

<% 
Application("name")="W3School"
Set Application("objtest")=Server.CreateObject("ADODB.Connection")
%>

အမှတ် 2

Contents စုစည်းကို လည်ပတ်ကြည့်ပါ:

<%
for each x in Application.Contents
  Response.Write(x & "=" & Application.Contents(x) & "<br />")
next
%>

သို့မဟုတ်:

<%
For i=1 to Application.Contents.Count
  Response.Write(i & "=" & Application.Contents(i) & "<br />")
Next
%>

အမှတ် 3

<%
Application("date")="2001/05/05"
Application("author")="W3School"
for each x in Application.Contents
  Response.Write(x & "=" & Application.Contents(x) & "<br />")
next
%>

输出:

date=2001/05/05
author=W3School

Session အပေါင်းအချုပ် အတွက်

အမှတ် 1

သတိပြုပါ၊ name နှင့် objtest ဟာ Contents စုစည်းသို့ ထပ်ထည့်ရမည်ဖြစ်ပါသည်:

<% 
Session("name")="Hege"
Set Session("objtest")=Server.CreateObject("ADODB.Connection")
%>

အမှတ် 2

Contents စုစည်းကို လည်ပတ်ကြည့်ပါ:

<%
for each x in Session.Contents
  Response.Write(x & "=" & Session.Contents(x) & "
") next %>

သို့မဟုတ်:

<%
For i=1 to Session.Contents.Count
  Response.Write(i & "=" & Session.Contents(i) & "<br />")
Next
%>

အမှတ် 3

<%
Session("name")="Hege"
Session("date")="2001/05/05"
for each x in Session.Contents
  Response.Write(x & "=" & Session.Contents(x) & "
") next %>

输出:

name=Hege
date=2001/05/05

Application 对象参考手册