文章分类 | 软件分类 | 最新软件 | 杀毒软件 | 实用软件  | MTV下载  | 设为首页 |
  | 下载分类 | 最近更新
您的位置: 首页 >> 文章首页 >> 技术开发 >> ASP 学院 >> ASP文摘 >>  
ASP文摘点击TOP10
·ASP中常用的文件处理函数2006-2-5 12:09:22
·开辟一条自由ASP快车道2006-2-9 16:21:52
·动态网站web开发 PHP、ASP还是ASP.NET2006-2-9 18:11:53
·关于学习ASP和编程的28个观点2006-2-9 16:30:10
·经典的利用插入Asp数据库插入语句2006-2-6 10:02:38
·ASP 函数语法速查表2006-2-9 9:39:32
·对一篇很长的文章做到完美的分页输出2006-2-9 14:22:18
·一些ASP初学者常用的代码2006-2-5 12:12:31
·微软下一代Web服务器IIS7细节披露2006-2-10 15:52:29
·在PPC上实现编译ASP2006-2-9 18:45:29
ASP 学院点击TOP10
·客户端脚本验证码总结2006-2-9 16:19:57
·选择最快的镜像站点2006-2-5 13:18:08
·在asp中调用jsp2006-2-5 13:33:14
·彻底终结浏览器Cahce页面的解决方案2006-2-5 13:31:26
·对ASP脚本源代码进行加密2006-2-9 14:58:12
·得到表中字段属性代码2006-2-5 13:33:31
·搜索引擎-带蜘蛛程序(类似GOOGLE)2006-2-9 20:17:17
·ASP中一个用VBScript写的随机数类2006-2-6 6:50:47
·提交信息关键字过滤类源码2006-2-9 20:11:40
·ASP.NET页面间的传值的几种方法2006-2-5 23:51:52

 

session变量中的数组如何引用
作者:我去下载           时间:2006-2-9 14:55:51


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

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

This is because the Session object is implemented as a collection. The array element StoredArray(3) does not receive the new value. Instead, the value is indexed into the collection, overwriting any information stored at that location.

It is strongly recommended that if you store an array in the Session 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 Session object again so that any changes you made are saved. This is demonstrated in the following example:

---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 Session object.
Session("StoredArray") = MyArray

Response.Redirect("file2.asp")
%>

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

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

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

分页:
相关文章:
Copyright© 2005-2006 wqxz.com, All Rights Reserved. 购买虚拟主机请与本站联系