<!--#include file="conntest.asp"-->
<!--#include file="conn.asp"-->
<%dim testpath,ars,conn1,connstr1,sql
if request("menu")="" then%>
<p>知识问答插件V1.1至V1.2升级程序：</p>
<p>使用前请备份你的程序和数据库。如果升级失败请用原程序替换即可。本升级不修改原数据库。</p>
<p>并请确保你的动网数据库的连接文件是：conn.asp</p>
<p>并请确保已用新的conntest.asp文件替换了你原来的知识问答库的连接文件。</p>
<p>请将知识问答插件V1.2的压缩包里的程序释放到论坛根目录，替换原来的文件。</p>
<p>升级时，将默认送给每个会员50个游戏币。</p>
<p>升级完成后将使用的数据库是新数据库：test0716.mdb,请自行更改conntest.asp和数据库名，以确保安全。</p>
<form method="POST" action="uptest.asp?menu=1">
  请输入原数据库地址、名称，请使用绝对路径：如：\bbs\test.mdb</p>
  <p><input type="text" name="T1" size="20">
  <input type="submit" value="提交" name="B1">
  <input type="reset" value="重置" name="B2"></p>
</form>
<p>　</p>
<% 
else
testpath=trim(request("t1"))
Set conn1 = Server.CreateObject("ADODB.Connection")
connstr1="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&testpath&"")
conn1.Open connstr1

set ars = Server.CreateObject("ADODB.Recordset")
sql="select lb,jj,time,title,key1,key2,key3,key4,ok,tx,tcount,okcount from [test]"
ars.open sql,conn1,1,1

set rs = Server.CreateObject("ADODB.Recordset")
sql="select lb,jj,time,title,key1,key2,key3,key4,ok,tx,tcount,okcount,username from [test]"
rs.open sql,aconn,1,3

do while not ars.eof
      rs.addnew
      rs(0)=ars(0)
      rs(1)=ars(1)
      rs(2)=ars(2)
      rs(3)=ars(3)
      rs(4)=ars(4)
      rs(5)=ars(5)
      rs(6)=ars(6)
      rs(7)=ars(7)
      rs(8)=ars(8)
      rs(9)=ars(9)
      rs(10)=ars(10)
      rs(11)=ars(11)
      rs(12)="nobody"
      rs.update
ars.movenext
loop
ars.close
response.write "题库升级完毕！<br> <br>"

set ars = Server.CreateObject("ADODB.Recordset")
sql="select lb from [testlb]"
ars.open sql,conn1,1,1

set rs = Server.CreateObject("ADODB.Recordset")
sql="select lb from [testlb]"
rs.open sql,aconn,1,3

do while not ars.eof
      rs.addnew
      rs(0)=ars(0)
      rs.update
ars.movenext
loop
ars.close
response.write "题库类别升级完毕！<br><br>"


set ars = Server.CreateObject("ADODB.Recordset")
sql="select username,intime,js,userpass,userans,userok,userup from [testuser]"
ars.open sql,conn1,1,1

set rs = Server.CreateObject("ADODB.Recordset")
sql="select username,intime,js,userpass,userans,userok,userup,ftl,usersinew from [testuser]"
rs.open sql,aconn,1,3

set rs1 = Server.CreateObject("ADODB.Recordset")

do while not ars.eof
sql="select article from [user] where username='"&ars(0)&"'"
rs1.open sql,conn,1,1
    if not rs1.eof and not rs1.bof then
      rs.addnew
      rs(0)=ars(0)
      rs(1)=ars(1)
      rs(2)=ars(2)
      rs(3)=ars(3)
      rs(4)=ars(4)
      rs(5)=ars(5)
      rs(6)=ars(6)
      rs(7)=rs1(0)
      rs(8)=50
      rs.update
     end if
rs1.close
ars.movenext
loop
ars.close
response.write "知识问答会员库升级完毕！<br><br>"
response.write "知识问答库全部升级完毕！重新设置你的知识问答后就可以使用了！"
end if
%>