一个项目中用到的数据同步实现

作者在 2007-03-29 03:51:00 发布以下内容
老板要求对每个代理商实现数据初始化,即把公司的报价数据全部导入到代理商的数据中.本来有更好的办法,不过自己最近变懒了,呵呵
chkid1.asp
 <!--#i nclude file="../inc/conn.asp"-->
 <!--#i nclude file="../inc/CheckLogined.asp" -->
  <%
  pid=trim(request.querystring("id"))
  id="5"
  Public MyArry()
  Public MyArry1()
  Public MyArry2()
  Public MyArry3()
  Public MyArry4()
  Public MyArry5()
  dim conn
  dim connstr
  dim sql
  dim rs
  sql="select * from class3 where h_operationid='" & id & "'"
  rs.open sql,conn,1,3
    total=Rs.recordcount
    response.write(total)
    redim preserve MyArry(total)
    redim preserve MyArry1(total)
    redim preserve MyArry2(total)
    redim preserve MyArry3(total)
    redim preserve MyArry4(total)
    redim preserve MyArry5(total)
    for i = 1 to total
    MyArry(i)=rs("h_name")
    MyArry1(i)=rs("h_money")
    MyArry2(i)=rs("h_class")
    MyArry3(i)=rs("h_pic")
    MyArry4(i)=rs("h_memo")
    MyArry5(i)=pid
    rs.movenext
    next
  rs.close
  %>

update.asp


 <!--#i nclude file="../inc/conn.asp"-->
 <!--#i nclude file="../inc/CheckLogined.asp" -->
 <!--#i nclude file="chkid1.asp" -->
 <%
  set rs1=server.CreateObject("adodb.recordset")
  sql="select * from class3"
  rs1.open sql,conn,1,3
  For j = 1 To total
  rs1.addnew
  rs1("h_name")=MyArry(j)
  rs1("h_money")=MyArry1(j)
  rs1("h_class")=MyArry2(j)
  rs1("h_pic")=MyArry3(j)
  rs1("h_memo")=MyArry4(j)
  rs1("h_operationid")=MyArry5(j)
  rs1.update
  response.write("数据同步成功,本次工共同步了:") & total &"条数据."
  Next
%>
技术随笔 | 阅读 1259 次
文章评论,共0条
游客请输入验证码
最新评论