虫子

技术值多少钱?
随笔 - 4, 文章 - 0, 评论 - 189, 引用 - 0
数据加载中……

ASP 一般读取的偷懒方法

Dget()

 

2{)2OE3X])C0YR@S5E6{U1E

代码如下.

''''''''''''''''''
'Dcse Get''''''''
'Dget("select * from Table","<li>$0 - $1</li>")
'''''''''''''''''
Function Dget(sqlTxt,strFormat)
    Dim regex,restr
    Set regex = New RegExp
    regex.Pattern    = "\$(\d+)"
    regex.Global     = True
    Set Matches = regEx.Execute(strFormat)
    set rs=conn.execute(sqlTxt)
    do while not rs.eof
        tmp=strFormat
        For Each Match in Matches
            n=int(right(Match.value,len(Match.value)-1))
            tmp=replace(tmp,"$"&n,rs(n))
        Next
        restr=restr&tmp& vbCRLF
        rs.movenext
    loop
    Dget=restr
End Function

posted on 2009-12-02 17:06 [虫子] 阅读(368) 评论(1)  编辑 收藏 引用 所属分类: 随便写写

只有注册用户登录后才能发表评论。