| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 383 人关注过本帖
标题:请大家帮忙仿写一下这段写入数据库的代码
只看楼主 加入收藏
king99121
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-1-31
收藏
 问题点数:0 回复次数:0 
请大家帮忙仿写一下这段写入数据库的代码
Function ClassUpdateCount(sortid,stype)
    Dim rscount,Parentstr
    On Error Resume Next
    Set rscount = NewAsp.Execute("SELECT ClassID,Parentstr FROM [NC_Classify] WHERE ChannelID=" & ChannelID & " And ClassID=" & CLng(sortid))
    If Not (rscount.BOF And rscount.EOF) Then
        Parentstr = rscount("Parentstr") &","& rscount("ClassID")
        If CInt(stype) = 1 Then
            NewAsp.Execute ("UPDATE [NC_Classify] SET ShowCount=ShowCount+1,isUpdate=1 WHERE ChannelID="& ChannelID &" And ClassID in (" & Parentstr & ")")
        ElseIf stype = 2 Then
            NewAsp.Execute ("UPDATE [NC_Classify] SET isUpdate=1 WHERE ChannelID="& ChannelID &" And ClassID in (" & Parentstr & ")")
        Else
            NewAsp.Execute ("UPDATE [NC_Classify] SET ShowCount=ShowCount-1,isUpdate=1 WHERE ChannelID="& ChannelID &" And ClassID in (" & Parentstr & ")")
        End If
    End If
    Set rscount = Nothing
End Function

上面你这段是范例,通过录入文章后开始对NC_Classify表中的ShowCount字段进行写入。现在我需要仿写一段:
Function AddUserPointNum(username,stype)
    Dim rscount,fawen
    On Error Resume Next
    Set rscount = NewAsp.Execute("SELECT ID,fawen FROM [NC_Admin] WHERE username=" & username & " And ID=" & CLng(id))
    If Not (rscount.BOF And rscount.EOF) Then
        fawen = rscount("fawen") &","& rscount("ID")
        If CInt(stype) = 1 Then
            NewAsp.Execute ("UPDATE [NC_Admin] SET fawen=fawen+1,isUpdate=1 WHERE username="& username &"")
        ElseIf stype = 2 Then
            NewAsp.Execute ("UPDATE [NC_Admin] SET isUpdate=1 WHERE username="& username &"")
        Else
            NewAsp.Execute ("UPDATE [NC_Admin] SET fawen=fawen-1,isUpdate=1 WHERE ID="& ChannelID &"")
        End If
    End If
    Set rscount = Nothing
End Function
我的想法是通过录入文章完毕后即向NC_Admin表中的fawen字段进行写入。由于是新手,对asp的语法都还不熟悉,恳请大家指教,本人万分感谢!!!
搜索更多相关主题的帖子: 数据库 代码 
2010-02-04 17:01
快速回复:请大家帮忙仿写一下这段写入数据库的代码
数据加载中...
 
   



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

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