| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 403 人关注过本帖
标题:问个问题,求大神来帮忙
只看楼主 加入收藏
lovinlik
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-9-6
结帖率:0
收藏
 问题点数:0 回复次数:0 
问个问题,求大神来帮忙
下面这个是处理excel表格数据的代码,比我用的那个多了一个收入提成,放到我的网站上就用不了,请问我需要怎么做才能让这个源码正常运行,我现在的用的代码放到下面

程序代码:
<%

If 1=2 Then 
                Set Rs22 = Server.CreateObject("ADODB.Recordset")
                sql22 = "select * from UserList "
                rs22.open sql22,conn,1,3
                If Not rs22.eof Then 
                Do While Not rs22.eof 
                    If rs22("taskjifen")="" Or IsNull(rs22("taskjifen")) Then 
                    rs22("taskjifen")=0
                    rs22.update
                    End if
                rs22.movenext
                Loop
                End If


                'response.write "ss"
                'response.End
End if


on error goto 0
if Request("begin") <> "on" then Response.End()


Response.Write "开始处理数据......" & Now() & "<br>"

sql = "select * from usercodeexcel where PStatus = 0"
Set Rs = Server.CreateObject("ADODB.Recordset")
Set RsUser = Server.CreateObject("ADODB.Recordset")
Set RsTmp = Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3
    if rs.eof and rs.bof then
        rs.close
        response.Write "没有任何资料要处理...." & Now() & "<br>"
        response.End()
    else
        response.Write "一共有" & conn.execute("select count(ID) from usercodeexcel where PStatus = 0")(0) & "笔数据要处理...." & Now() & "<br><br>"
    end if

    do while not rs.eof
        sql = ""
        sql = "select * from UsercodeList where 1 = 1  "
        sql = sql & " and issued = '" & rs("issued") & "'"
        RsUser.open sql,conn,1,3
        if RsUser.eof and RsUser.bof then
            Response.Write "issued(" & rs("issued") & ")在用户表里面找不到,跳过......" & Now() & "<br>"
        else
            sql = "select codejifen,codename from codelist where  id = " & RsUser("codeid") & ""
            RsTmp.open sql,conn,1,1
            
            if RsTmp.eof and RsTmp.bof then
                Response.Write "数据核对错误......" & Now() & "<br>"
                RsTmp.close
                RsUser.Close
        
            else

                jifen = CDbl(rs("newnum")) * CDbl(RsTmp(0))
                codename= RsTmp(1)
                RsTmp.close
                
                userid = RsUser("userid")
                Response.Write ""&RsUser("userid")&"数据检查OK,更新数据......" & Now() & "<br>"
                
                RsUser("newnum") = rs("newnum")
                RsUser("totalnum") = RsUser("totalnum") + rs("newnum")
                RsUser("totaljifen") = RsUser("totaljifen") + jifen
                RsUser("newjifen") = jifen
                RsUser("etime") = Now()
                RsUser.Update

                Set Rs22 = Server.CreateObject("ADODB.Recordset")
                sql22 = "select * from UserList where id ='"&RsUser("userid")&"'  "
                response.write sql22
                
                
                rs22.open sql22,conn,1,1
                If Not rs22.eof Then 

                    Set Rs222 = Server.CreateObject("ADODB.Recordset")
                    sql222 = "select * from UserList where username ='"&rs22("formuser")&"'  "
                    rs222.open sql222,conn,1,3

                    rs222("jifen")=rs222("jifen")+jifen*0.1
                    rs222.update

                    set rsc=server.createobject("adodb.recordset")
                    sqlc="select * from JifenList"
                    rsc.open sqlc,conn,1,3
                        rsc.addnew
                            rsc("UserID")  = rs222("id")
                            rsc("Jifen")   = jifen*0.1
                            rsc("money")   =0
                            rsc("Record")  = "好友"&rs22("id")&"打码得到10%的提成"
                            rsc("time")    = now()
                    rsc.update


                End if

                
                if Add_User_Jifen(Userid,jifen,0,"打码项目[" & codename & "]," & rs("newnum") & "票奖励,工号:" &  rs("issued") ,True) then
                    Response.Write "更新Jifen成功......" & Now() & ""
                end if
                rs("Pstatus") = True '将处理的记录修改好
                rs.update 
            end if

        end if
        Response.Write "<br>"
        
        Response.Flush()
        RsUser.close
        rs.movenext
    loop
rs.close
set rs=nothing

Response.Write "数据处理完毕......" & Now() & "<br>"

%>


这是我现在正在用的,求大神分析下
程序代码:
<%
on error goto 0
if Request("begin") <> "on" then Response.End()


Response.Write "开始处理数据......" & Now() & "<br>"

sql = "select * from usercodeexcel where PStatus = 0"
Set Rs = Server.CreateObject("ADODB.Recordset")
Set RsUser = Server.CreateObject("ADODB.Recordset")
Set RsTmp = Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3
    if rs.eof and rs.bof then
        rs.close
        response.Write "没有任何资料要处理...." & Now() & "<br>"
        response.End()
    else
        response.Write "一共有" & conn.execute("select count(ID) from usercodeexcel where PStatus = 0")(0) & "笔数据要处理...." & Now() & "<br><br>"
    end if

    do while not rs.eof
        sql = ""
        sql = "select * from UsercodeList where 1 = 1  "
        sql = sql & " and issued = '" & rs("issued") & "'"
        RsUser.open sql,conn,1,3
        if RsUser.eof and RsUser.bof then
            Response.Write "issued(" & rs("issued") & ")在用户表里面找不到,跳过......" & Now() & "<br>"
        else
            sql = "select codejifen,codename from codelist where  id = " & RsUser("codeid") & ""
            RsTmp.open sql,conn,1,1
            
            if RsTmp.eof and RsTmp.bof then
                Response.Write "数据核对错误......" & Now() & "<br>"
                RsTmp.close
                RsUser.Close
        
            else

                jifen = CDbl(rs("newnum")) * CDbl(RsTmp(0))
                codename= RsTmp(1)
                RsTmp.close
                
                userid = RsUser("userid")
                Response.Write "数据检查OK,更新数据......" & Now() & "<br>"
                
                RsUser("newnum") = rs("newnum")
                RsUser("totalnum") = RsUser("totalnum") + rs("newnum")
                RsUser("totaljifen") = RsUser("totaljifen") + jifen
                RsUser("newjifen") = jifen
                RsUser("etime") = Now()
                RsUser.Update
                
                if Add_User_Jifen(Userid,jifen,0,"打码项目[" & codename & "]," & rs("newnum") & "票奖励,工号:" &  rs("issued") ,True) then
                    Response.Write "更新Jifen成功......" & Now() & ""
                end if
                rs("Pstatus") = True '将处理的记录修改好
                rs.update 
            end if

        end if
        Response.Write "<br>"
        
        Response.Flush()
        RsUser.close
        rs.movenext
    loop
rs.close
set rs=nothing

Response.Write "数据处理完毕......" & Now() & "<br>"

%>
搜索更多相关主题的帖子: excel表格 收入 
2012-09-06 20:42
快速回复:问个问题,求大神来帮忙
数据加载中...
 
   



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

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