一个用application存数组的例子

application|数组

If you store an array in an Application object, you should not attempt to alter the elements of the stored array directly. For example, the following script does not work:

<% Application("StoredArray")(3) = "new value" %>

This is because the Application object is implemented as a collection. The array element StoredArray(3) does not receive the new value. Instead, the value would be included in the Application object collection, and would overwrite any information that had previously been stored at that location.

It is strongly recommended that if you store an array in the Application object, you retrieve a copy of the array before retrieving or changing any of the elements of the array. When you are done with the array, you should store the array in the Application object again, so that any changes you made are saved. This is demonstrated in the following scripts.

---file1.asp---
<%
'Creating and initializing the array.
dim MyArray()
Redim MyArray(5)
MyArray(0) = "hello"
MyArray(1) = "some other string"

'Storing the array in the Application object.
Application.Lock
Application("StoredArray") = MyArray
Application.Unlock

Server.Transfer("file2.asp")
%>

---file2.asp---
<%
'Retrieving the array from the Application Object
'and modifying its second element.
LocalArray = Application("StoredArray")
LocalArray(1) = " there"

'Printing out the string "hello there."
Response.Write(LocalArray(0)&LocalArray(1))

'Re-storing the array in the Application object.
'This overwrites the values in StoredArray with the new values.
Application.Lock
Application("StoredArray") = LocalArray
Application.Unlock
%>

时间: 2024-10-28 23:53:21

一个用application存数组的例子的相关文章

用application存数组的例子

application|数组 If you store an array in an Application object, you should not attempt to alter the elements of the stored array directly. For example, the following script does not work:<br><br><% Application("StoredArray")(3) = &

异常-java核心技术中一个关于数组的例子不理解,请教大家

问题描述 java核心技术中一个关于数组的例子不理解,请教大家 Person是Employer的父类,Employer有个新方法setBonus,代码如下 Employer[] emprs ={new Employer("张三"),new Employer("李四")}; Person[] ps =emprs; ps[0] = new Person("小明");//运行时该行报错ArrayStoreException emprs[0].setBo

数据存数组,新人求大神们解答啊

问题描述 数据存数组,新人求大神们解答啊 我从页面取到的值是 A1A2A3A4A5................不知道用户会输入多少 我怎么把这些数据保存到数组呢 解决方案 String类的split方法可以使用给定的正则表达式分割字符串为字符串数组Case: String str = ""A1A2A3A4A5""; String[] strArr = str.split(""); 解决方案二: 总该有一个结束标记吧..ps:什么语言? 解决方

一个关于指针和数组的问题

问题描述 一个关于指针和数组的问题 #define _CRT_SECURE_NO_WARNINGS#include ""stdlib.h""#include ""stdio.h""#include ""string.h"" int main(){ char buf1[100] = { 0 }; char buf2[100] = { 0 }; char *p1 = buf1; char *

c++-C++中queue能存数组吗?

问题描述 C++中queue能存数组吗? 如题queue searchlist;queue中存数组,每一个元素是一个二维坐标.这样行吗?声明okay,但是searchlist.push()就不行了 解决方案 你需要声明一个结构体或者类,把他作为queue的元素 #include<iostream>#include<queue>using namespace std;struct Point{ int x; int y;};int main(){ queue<Point>

PHP将二维数组某一个字段相同的数组合并起来的方法_php技巧

本文实例讲述了PHP将二维数组某一个字段相同的数组合并起来的方法.分享给大家供大家参考,具体如下: 例子: array(3) { [0]=> array(16) { ["id"]=> string(2) "42" ["uid"]=> string(2) "14" ["euid"]=> string(2) "56" ["did"]=> st

javascript操作数组的例子与函数详解介绍

1):join() 方法: 把一个数组的所有元素都转换成字符串. 比如: var  a  = [1,2,3]; var s =   a.join();   // 输出 s==1,2,3 当然也可以 指定一个分隔符: 比如; \s = a.join(","); 这个方法跟String.split()相反, split()将一个字符串分割成几个片段来创建数组: 2):reverse () 方法: 把一个数组颠倒. var  a   = new Array(1,2,3); a.reverse

php一个解析字符串排列数组的方法

  本文实例讲述了php一个解析字符串排列数组的方法.分享给大家供大家参考.具体如下: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 <?php $str="1|苹果|30 1|桃子|50 1|普通|10 2|小麦|100 2|玉米|35 2|大米|30 3|电脑|5 3|MP3|121 3|打印机|8"; $strArray=explode("n",$str); /*关键的是下面的代码*

全显示成正数-安卓开发中如何使一个byte类型的数组内的数据不显示成负数

问题描述 安卓开发中如何使一个byte类型的数组内的数据不显示成负数 在做Android开发的时候一个byte类型的数组result,里面有比较大的正数,需要做什么样的处理才能使他显示的全是正数:求大神指导,给个代码 byte[] result for (int i = 0; i < result.length; i++) Log.e("读出全部page", "byte " + i + " is " + result[i]); 解决方案 f