Settings | Sign in | Sign up

There is currently 1 post.

【数据库】数据库中存放数组

Floor 1 产品的注销 1/22/11 15:21
【数据库】数据库中存放数组 2010年04月23日 07:09
在数据库中也能存放数组,只要满足下列条件就行了:
1.该字段必须是“备注”型;
2.每个元素用任意符号分隔,如“5||4||6||巨大八爪鱼||欢迎大家来到魔塔12吧”。
那么如何在ASP取出数据库中数组的某个元素呢?其实很简单。
<%
I=""
I=Split(rs("字段名"),"||")
Response.Write(I(3))
%>
这时就会输出数组中第三个元素“巨大八爪鱼”。

其实我通常都是用的“||”分隔数据,如“5||4||6||巨大八爪鱼||欢迎大家来到魔塔12吧”,当然你也可以用其它符号分隔,比如“呵呵???这不是ASP吗???哦”,这里把分隔符改成了“???”,所以在代码中I=Split(rs("字段名"),"||")也应改成I=Split(rs("字段名"),"???")。
  

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
©2010-2025 Purasbar Ver3.0 [Mobile] [Desktop]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported license.