如何向asp网页中添加SQL数据程序
<linkHref="../images/doc.css"Type=text/cssRel=stylesheet><br/><formaction="?begin=on"...
<link Href="../images/doc.css" Type=text/css Rel=stylesheet>
<br />
<form action="?begin=on" method="post"><input type="submit" value="点击开始处理" /></form>
<%
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")
Set Rsjif = 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>"
%>
添加一段代码 使表UsercodeList (userid )的推荐人(tjr) 的积分(jifen)加上userid的刚获得的积分*0.1写入上级积分中
表UsercodeList
ID userid
1 1088
2 1045
表useridlist
id name tjr jifen
1088 aqzt werw 58
1045 werw ertd 90
代码如何写,写好后家在哪里 展开
<br />
<form action="?begin=on" method="post"><input type="submit" value="点击开始处理" /></form>
<%
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")
Set Rsjif = 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>"
%>
添加一段代码 使表UsercodeList (userid )的推荐人(tjr) 的积分(jifen)加上userid的刚获得的积分*0.1写入上级积分中
表UsercodeList
ID userid
1 1088
2 1045
表useridlist
id name tjr jifen
1088 aqzt werw 58
1045 werw ertd 90
代码如何写,写好后家在哪里 展开
展开全部
用SQL语句写入数据库记录
sql="insert into(name,tjr,jifen) values('name的值','tjr的值','jifen的值')" 'sql写入数据库语句
conn.exeucte(sql) '发送sql命令
sql="insert into(name,tjr,jifen) values('name的值','tjr的值','jifen的值')" 'sql写入数据库语句
conn.exeucte(sql) '发送sql命令
追问
是要写入里面的,请写详细些,谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询