标题:asp调用数据库,请帮忙精简下语句
只看楼主
liuyajian
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-8-17
 问题点数:0 回复次数:0 
asp调用数据库,请帮忙精简下语句
  大量雷同代码,太繁琐了,哪位大侠帮我精简下
  <%
    set js=Server.CreateObject("Adodb.RecordSet")
        set ws=Server.CreateObject("Adodb.RecordSet")
            set bs=Server.CreateObject("Adodb.RecordSet")
    sqlj="select count(*) from T1511y228428B38 where Fn151173F2224016='aaa' and datediff(day,F154T41122g23713,getdate())=0"
    sqlw="select count(*) from T1511y228428B38 where Fn151173F2224016='aaa' and datediff(week,F154T41122g23713,getdate())=0"
    sqlb="select count(*) from T1511y228428B38 where Fn151173F2224016='aaa' and datediff(month,F154T41122g23713,getdate())=0"
    ws.open sqlw, conn, 1,1
    js.open sqlj, conn, 1,1
    bs.open sqlb, conn, 1,1   
    %>
<table>
<tr>
<td><%=js(0)%></td>
<td><%=ws(0)%></td>
<td><%=bs(0)%></td>
</tr>
</table>
    <%
    bs.close
    set bs=nothing
    ws.close
    set ws=nothing
    js.close
    set js=nothing
    %>
   
2015-11-04 21:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-458886-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.093119 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved