| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 310 人关注过本帖
标题:vb 高手帮帮忙,我不用数组~
只看楼主 加入收藏
yushan_0008
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2009-6-16
结帖率:86.96%
收藏
已结贴  问题点数:20 回复次数:4 
vb 高手帮帮忙,我不用数组~
Function ChannelCount(sChannelID,sType)
    Cl.Load_ChannelSetting(sChannelID)
    Dim rsCount(2) as integer,ModuleName
    Select Case CLng(Cl.Channel.selectSingleNode("@moduleid").text)
    Case 1 : ModuleName = "Article"
    Case 2 : ModuleName = "Soft"
    Case 3 : ModuleName = "Photo"
    Case 4 : ModuleName = "Movie"
    Case 5 : ModuleName = "Product"
    Case Else : ModuleCount = 0 : Exit Function
    End Select
    Select Case sType
    Case 0
        Set rsCount(0) = Cl.Execute("select count(InfoID) from Cl_"&ModuleName&" where ChannelID="&sChannelID&" and Deleted="&FalseType)
        Set rsCount(1) = Cl.Execute("select sum(Hits) from Cl_"&ModuleName&" where ChannelID="&sChannelID&" and Deleted="&FalseType)

    Case 1
        Set rsCount(0) = Cl.Execute("select count(InfoID) from Cl_"&ModuleName&" where ChannelID="&sChannelID&" and Status=1 and Deleted="&FalseType)
        Set rsCount(1) = Cl.Execute("select sum(Hits) from Cl_"&ModuleName&" where ChannelID="&sChannelID&" and Status=1 and Deleted="&FalseType)
    Case 2
        Set rsCount = Cl.Execute("select count(InfoID) from Cl_"&ModuleName&" where ChannelID="&sChannelID&" and Status=0 and Deleted="&FalseType)
    Case 3 '===(3) 阅读
        Set rsCount = Cl.Execute("select sum(Hits) From Cl_"&ModuleName&" where ChannelID="&sChannelID&" ")
    Case 4 '===(4) 评论总数
        Set rsCount = Cl.Execute("select count(CommentID) from Cl_Comment where ChannelID="&sChannelID&"")
    Case 5 '===(5) 已审评论
        Set rsCount = Cl.Execute("select count(CommentID) from Cl_Comment where ChannelID="&sChannelID&" and Status=1")
    Case 6 '===(6) 待审评论
        Set rsCount = Cl.Execute("select count(CommentID) from Cl_Comment where ChannelID="&sChannelID&" and Status=0")
    Case 7 '===(7) 专题总数
        Set rsCount = Cl.Execute("select count(SpecialID) from Cl_Special where ChannelID="&sChannelID&"")
    Case Else
        ChannelCount = 0 : Exit Function
    End Select
    ChannelCount = rsCount()
    rsCount.Close : Set rsCount = Nothing
End Function
帮忙看看,我只改了两个case条件,其他的case条件不用管。可是不能显示结果,请大家看看帮帮忙~我加颜色的地方是不是有哪儿不对了
2009-07-22 09:34
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:14 
Dim rsCount(2) as integer
楼主确定rsCount里存储的是Integer类型的数据?而且这个是Visual Basic?还是VBScript?
2009-07-22 13:02
yushan_0008
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2009-6-16
收藏
得分:0 
回复 2楼 yms123
是VBScript,原来是这样啊,那是在access 中显示是数字,应该是对的吧
2009-07-22 15:02
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
可是你这段代码里rsCount明显是做的ADODB.RecordSet的操作,你给rsCount声明为Integer做什么?
2009-07-22 15:28
yushan_0008
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2009-6-16
收藏
得分:0 
回复 4楼 yms123
我不会,从网上粘的,不对啊?我不知道,所以才来问大家的
2009-07-22 16:09
快速回复:vb 高手帮帮忙,我不用数组~
数据加载中...
 
   



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

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