asp中字符串转化为实体类的方法(提高篇,自动方法)
	
    
    
	书接上文,直接从字符串返回对象,此次更新,实现了返回对象的自动化,无需在声明实体类。但这个函数只适合页面声明几个对象,批量对象,比如几百个,推荐使用下一文所使用函数。
函数很简单,不解释,直接贴代码。
option explicit
'返回对象的函数
function getObj(byval str)
    dim classname,itemlist,i
    classname = split(str,"|||")(0)
    dim execstr
    execstr =  "class "&classname&chr(10) 
    itemlist = split(split(str,"|||")(1),",")
    for i = 0 to ubound(itemlist)
        execstr = execstr +"public "&split(itemlist(i),":")(0)&chr(13)&chr(10)
    next
    execstr = execstr + "Private Sub Class_Initialize"&chr(13)&chr(10)
    for i = 0 to ubound(itemlist)
                execstr = execstr +split(itemlist(i),":")(0)&" = """&split(itemlist(i),":")(1)&"""" &chr(13)&chr(10)
    next
    execstr = execstr&"end sub"&chr(13)&chr(10)&_
            "end class"&chr(13)&chr(10)&_
            " set getobj = new "&classname
    execute execstr
end function
'测试部分
dim str1
str1 ="order|||shiyang:100,mayang:200"
sub ceshi2
	dim i,o1
    for i = 0 to 10000
    set o1 =  getObj(str1)
    response.write o1.shiyang&"<br>"
    next
end sub
dim t1
t1=timer()
call ceshi2
response.write FormatNumber((timer()-t1),4,-1) 
下期更精彩!!!!
    
     
	
	
    
    
	相关文档:
        
    
    用ASP制作张扬个性的调查系统(1)
   
  随着网络的普及,网上调查往往能达到较好的效果。在自己的个人站点上放一个趣味问题调查板,着实能为网站添色不少;况且通过调查结果你能更多更准确了解网友对自己站点的看法。作为Webmaster,如果你的网站也需要就某个主题进行调查,而你又讨厌使用别人免费提供的调查 ......
	
    
        
    
    用ASP设计网站在线人数统计程序
   
  在浏览网页的时侯,常常可以看见一些“当前网站上的人数是XXX人”的在线人数同计。如何用ASP来做一个呢?首先,分析一下它的做法,一般来说,这些线上人数统计都是指一个时段内的访客人数统计。比如(5分钟内,10分钟内)而这个时间的长短,是由设计者设定 ......
	
    
        
    
    <bgsound src="wen.mid" loop="0"> 
  <% dim weh 
  If Time >=#1:00:00 AM# And Time < #6:00:00 PM# Then 
   weh = "<bgsound src="1.mid" loop="0">" 
  Else If Time >#6:00:00 AM# And Time < #9:00:00 PM# 
   weh = "<bgso ......
	
    
        
    
    目前在Internet上广泛使用的后台技术种类繁多,应用比较广泛的有CGI,ASP,PHP,JSP/JavaServlet,ColdFusion等。在这一节里,主要介绍几种在国内应用比较广泛的后台语言。 
  CGI,全称为Common Gateway Interface 
  CGI就是公共网关接口 (Common Gateway Interface) 的缩写。它是最早被用来建立动态网站的后台技术 ......