<%
datafile="guluu#gbss#data.mdb"  '请改为您论坛数据库的路径
Server.ScriptTimeout=300  
Set Conn=Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&datafile&"")
conn.Open connstr
Set rs = Server.CreateObject("ADODB.Recordset")

dim menu,body
menu=request.querystring("menu")
if menu="" then
 		call start()
		end if 
if menu="1" then
 		call add()
		end if 
	if menu="2" then
 		call main()
	end if
if menu="3" then
 		call importitems()
		end if 

sub add
on error resume next

'开始创建论坛秀表
conn.execute("CREATE TABLE myshow")
conn.execute("alter table myshow add ID int")
conn.execute("alter table myshow add Name varchar(50)")
conn.execute("alter table myshow add Sex int")
conn.execute("alter table myshow add Content varchar(255)")
conn.execute("alter table myshow add Type int")
conn.execute("alter table myshow add Price1 int")
conn.execute("alter table myshow add Price2 int")
conn.execute("alter table myshow add Period int")
conn.execute("alter table myshow add Flag int")
conn.execute("alter table myshow add Quantity int")
conn.execute("alter table myshow add Vip Bit default false")
conn.execute("alter table myshow add DateAndTime Datetime default Now()")
conn.execute("alter table myshow add TotalSales int")

conn.execute("CREATE TABLE myshow_photo")
conn.execute("alter table myshow_photo add id int IDENTITY (1, 1) NOT NULL CONSTRAINT PrimaryKey PRIMARY KEY")
conn.execute("alter table myshow_photo add username varchar(255)")
conn.execute("alter table myshow_photo add explain varchar(255)")
conn.execute("alter table myshow_photo add photo varchar(255)")
conn.execute("alter table myshow_photo add regtime Datetime default Now()")
conn.execute("alter table myshow_photo add photoshow Bit default false")
conn.execute("alter table myshow_photo add vote int")
conn.execute("alter table myshow_photo add voter memo")

conn.execute("CREATE TABLE myshow_present")
conn.execute("alter table myshow_present add id int IDENTITY (1, 1) NOT NULL CONSTRAINT PrimaryKey PRIMARY KEY")
conn.execute("alter table myshow_present add myshowid varchar(255)")
conn.execute("alter table myshow_present add getid varchar(255)")
conn.execute("alter table myshow_present add gettime Datetime")
conn.execute("alter table myshow_present add buytime Datetime")
conn.execute("alter table myshow_present add giveid varchar(255)")
conn.execute("alter table myshow_present add type varchar(50)")

conn.execute("CREATE TABLE myshow_subtype")
conn.execute("alter table myshow_subtype add ID int IDENTITY (1, 1) NOT NULL CONSTRAINT PrimaryKey PRIMARY KEY")
conn.execute("alter table myshow_subtype add TypeSeq int")
conn.execute("alter table myshow_subtype add SubTypeName varchar(50)")
conn.execute("alter table myshow_subtype add SeqNo int")
conn.execute("alter table myshow_subtype add orders int")
conn.execute("alter table myshow_subtype add visible Bit default false")

conn.execute("CREATE TABLE myshow_type")
conn.execute("alter table myshow_type add ID int IDENTITY (1, 1) NOT NULL CONSTRAINT PrimaryKey PRIMARY KEY")
conn.execute("alter table myshow_type add TypeName varchar(50)")
conn.execute("alter table myshow_type add SeqNo int")
conn.execute("alter table myshow_type add orders int")
conn.execute("alter table myshow_type add visible Bit default false")

''''''''''''''''''''''''''yougyang modified'''''''''''
'这里开始对user表操作
conn.execute("alter table [BBSXP_Users] add myshow varchar(255)")
conn.execute("alter table [BBSXP_Users] add mybuyshow varchar(255)")
conn.execute("alter table [BBSXP_Users] add qqx varchar(255)")

'这里对clubconfig表操作
conn.execute("alter TABLE [BBSXP_SiteSettings] add showme int default 0")
conn.execute("update [BBSXP_SiteSettings] set showme=0")


%>

<%call top%>
 </tr>
        <tr>
          <td width="100%" height="273" valign="top" class=a4>
          
          <div align="center">
            <center>
            <table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" cellpadding="0" id="AutoNumber2" height="270">
              <tr>
                <td width="100%" height="270">
          　<p align="center"><font color=red>&nbsp;成功增加了五张表，以及其他相应字段。</font></p><br>
<br>&nbsp;

               </td>
              </tr>
            </table>
            </center>
          </div>

　</td>
        </tr>
        <tr>
          <td width="100%" height="25"  class=a1>
          <p align="center"><INPUT type="button" value="执行下一步" ID="Button1" NAME="Button1"  onclick="JavaScript:location.href='?menu=2'">
		  <BR><BR></td>
  </tr>
</table>

<%
end sub
sub main() 
%>
<%call top%>

</tr>
        <tr>
          <td width="100%" height="273" valign="top" class=a4>
          
          <div align="center">
            <center>
            <table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" cellpadding="0" id="AutoNumber2" height="270">
              <tr>
                <td width="100%" height="270">
          　<PRE><font color=red>
输入完要导入的数据库名称后，点击确定按扭！

　　　　　导入数据可能要一两分钟,请稍等.....
</font></pre>

请输入将导入的数据库文件名<BR>

<center>
<form name="form1" method="post" action="?menu=3"> 
注:默认为qqx.mdb<br><INPUT type=text name=newvisualfile size="20">&nbsp; <INPUT type=submit value=确认 name=submit></td> 
</form> </center>
               </td>
              </tr>
            </table>
            </center>
          </div>

　</td>
        </tr>
        <tr>
          <td width="100%" height="25"  class=a1>
          
		  <BR><BR></td>
  </tr>
</table>


<%end sub

function checkStr(str)
	if isnull(str) then
		checkStr = ""
		exit function 
	end if
	checkStr=replace(str,"'","''")
end function
sub importitems()



dim sql1,rs1,sql2,rs2,visualname,TCONN,icount,pcount,wx,wxd

	visualname=Checkstr(trim(request("newvisualfile")))
	if visualname="" then
		ErrMsg=ErrMsg+"<Br>"+"<li>请填写导入的数据库名"
		response.write Errmsg
		exit sub
	end if
	Set tconn = Server.CreateObject("ADODB.Connection")
	tconn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(visualname)
	dim trs,nrs

	'sql1="select * from myshow_type" 
'set rs1=conn.execute(sql1)
	set trs=tconn.execute(" select * from myshow_type ")
	sql="select * from myshow_type" 
        rs.Open "select * from myshow_type",Conn,1,3

	icount=0
	pcount=0
	do while not trs.eof
		if conn.execute("select top 1 ID from myshow_type where id="&trs("id")).eof then

rs.AddNew   
rs("ID")=trs("ID")
rs("TypeName")=trs("TypeName")
rs("SeqNo")=trs("SeqNo")
rs("orders")=trs("orders")
rs("visible")=trs("visible")
rs.Update
			icount=icount+1
		else
			pcount=pcount+1
		end if
		trs.movenext
	loop
	trs.close
	set trs=nothing
	rs.close
	response.write  ""
	%>
	<%call top%>
	</tr>
        <tr>
          <td width="100%" height="273" valign="top" class=a4>
          
          <div align="center">
            <center>
            <table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" cellpadding="0" id="AutoNumber2" height="270">
              <tr>
                <td width="100%" height="50">
<div align=right><font color=red>成功(导入"<%=icount%>"个新商品类别，跳过"<%=pcount%>"个已有商品类别)！</font></div>
</td></tr>
<%
	'sql1="select * from myshow_subtype" 
'set rs1=conn.execute(sql1)
    set trs=tconn.execute(" select * from myshow_subtype ")
	sql="select * from myshow_subtype" 
        rs.Open "select * from myshow_subtype",Conn,1,3

	icount=0
	pcount=0
	do while not trs.eof
		if conn.execute("select top 1 ID from myshow_subtype where id="&trs("id")).eof then

rs.AddNew   
rs("ID")=trs("ID")
rs("subTypename")=trs("subTypename")
rs("typeseq")=trs("typeseq")
rs("SeqNo")=trs("SeqNo")
rs("orders")=trs("orders")
rs("visible")=trs("visible")
rs.Update
			icount=icount+1
		else
			pcount=pcount+1
		end if
		trs.movenext
	loop
	trs.close
	set trs=nothing
	rs.close
	response.write  ""
%>
<tr><td width="100%" height="50">
<div align=right><font color=red>成功(导入"<%=icount%>"个新商品分类，跳过"<%=pcount%>"个已有商品分类)！</font></div>
</td>
              </tr>
           
<%
'sql1="select * from myshow" 
'set rs1=conn.execute(sql1)
	set trs=tconn.execute(" select * from myshow ")
	sql="select * from myshow" 
        rs.Open "select * from myshow",Conn,1,3

	icount=0
	pcount=0
	do while not trs.eof
		if conn.execute("select top 1 ID from myshow where id="&trs("id")).eof then

rs.AddNew   
rs("ID")=trs("ID")
rs("Name")=trs("Name")
rs("Sex")=trs("Sex")
rs("Type")=trs("Type")
rs("Content")=trs("Content")
rs("Price1")=trs("Price1")
rs("Price2")=trs("Price2")
rs("Period")=trs("Period")
rs("Quantity")=trs("Quantity")
rs("Flag")=trs("Flag")
rs("Vip")=trs("Vip")
rs.Update
			icount=icount+1
		else
			pcount=pcount+1
		end if
		trs.movenext
	loop
	trs.close
	set trs=nothing
	rs.close
	response.write ""
	%>



              <tr>
                <td width="100%" height="270">
          　<p align="center">　<center><font color=red size=7>完成！</font><br></center><BR><font color=#0000FF>祝贺您插件数据已更新入成功(更新了"<%=icount%>"个商品，跳过"<%=pcount%>"个已有商品)！<BR><br>最后欢迎您常到
			我的论坛交流！！<font color=red>(完成后请删除升级文件:up_qqshow.asp)</font></p>
<br>&nbsp;

               </td>
              </tr>
            </table>
            </center>
          </div>

　</td>
        </tr>
        <tr>
          <td width="100%" height="25"  class=a1>
          <p align="center"><INPUT type="button" value="点击完成" ID="Button1" NAME="Button1"  onclick="JavaScript:location.href='http://bbs.zy51.com'">
		  <BR><BR></td>
  </tr>
</table>


<%
end sub
sub start()
%>
<%call top%>
</tr>
        <tr>
          <td width="100%" height="273" valign="top" class=a4>
          
          <div align="center">
            <center>
            <table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" cellpadding="0" id="AutoNumber2" height="270">
              <tr>
                <td width="100%" height="270">
          　<pre><font color=red><b>《BBSXP 虚拟形象插件》</b>数据库最新升级程序：</font>

<font color=#0000FF><BR> &nbsp;&nbsp; ①请将解压的两个文件都上传到您论坛数据库文件夹下！在开始升级数据库的时
候请先备份好数据库，以防万一！<BR>&nbsp;&nbsp;&nbsp;&nbsp;②请用记事本打本文件，查找相关字符进行修改！默认论坛数据库为"bbsxp.mdb"，
请打改为您论坛数据库名。确定升级数据库请按下一步！</font></pre><br>
<br>&nbsp;

               </td>
              </tr>
            </table>
            </center>
          </div>

　</td>
        </tr>
        <tr>
          <td width="100%" height="25"  class=a1>
          <p align="center"><INPUT type="button" value="执行下一步" ID="Button1" NAME="Button1"  onclick="JavaScript:location.href='?menu=1'">
          
<BR><BR></td>
  </tr>
</table>
<%end sub%>

<%sub top()%>
<html>
<head>
<link href="http://www.zy51.com/bbsxp/images/skins/1/bbs.css" rel="stylesheet"><STYLE type=text/css>
A:link {
	COLOR: #0000FF; TEXT-DECORATION: none
}
A:visited {
	COLOR: #313131; TEXT-DECORATION: none
}
A:active {
	COLOR: #0000FF; TEXT-DECORATION: none
}

A:hover {
	COLOR: #FF0000;LEFT: 1px; POSITION: relative;TEXT-DECORATION: NONE; TOP: 1px
}

</STYLE>

<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>BBSXP QQ秀数据库在线升级文件</title>
</head>

<body>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="543">
  <tr>
    <td width="100%" height="543">
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="1" style="border-collapse: collapse" class=a2 width="70%" height="325">
        <tr>
          <td width="100%" height="25" class=a1>&nbsp;<b>BBSXP	QQ秀数据库在线升级文件</b></td>
<%end sub%>
</body>
</html>

