<!--#include file="Start.asp"-->
<%
Server.ScriptTimeOut = 9999999
Dim EndTime, i
Dim Conn_Old, db_type, db_access, db_sql
Dim UpdateTable, TableName, Info_CurrentUpdate
Dim RecordNum, RecordIndex, TotalRecordNum, TotalRecordIndex
Dim ArrSkinID(), ArrTemplateID()
ReDim ArrSkinID(0, 0), ArrTemplateID(0, 0)

Dim ChannelDir
TotalRecordIndex = 0

Dim rsNew, rsOld
Set rsNew = Server.CreateObject("ADODB.Recordset")
Set rsOld = Server.CreateObject("ADODB.Recordset")

Response.Write "<html>" & vbCrLf
Response.Write "<head>" & vbCrLf
Response.Write "<title>动易2005版 To SiteWeaver6.6版 数据库升级程序</title>" & vbCrLf
Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">" & vbCrLf
Response.Write "<link href=""" & AdminDir & "/Admin_STYLE.CSS"" rel=""stylesheet"" type=""text/css"">" & vbCrLf
Response.Write "</head>" & vbCrLf
Response.Write "<body>" & vbCrLf

Action = Trim(request("Action"))
Select Case Action
Case "SelectDatabase"
    Call SelectDatabase
Case "SelectTable"
    Call SelectTable
Case "Update"
    Call Update
Case "Del"
    Call Del
Case Else
    Call Main
End Select

Call CloseConn
Response.Write "</body></html>"


Sub Main()
    Response.Write "<table width=""700"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"" class=""border"">" & vbCrLf
    Response.Write "  <form name=""myform"" method=""post"" action=""Upgrade.asp"">" & vbCrLf
    Response.Write "  <tr align=""center"" class=""topbg"">" & vbCrLf
    Response.Write "    <td height=""25""><strong>动易 2005版 To SiteWeaver6.6版 数据库升级程序</strong></td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr>" & vbCrLf
    Response.Write "    <td height=""60"" align=right>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""60"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""border-bottom: 1px solid #999999;"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td>" & vbCrLf
    Response.Write "            <strong>操作步骤：</strong><br>" & vbCrLf
    Response.Write "            &nbsp;&nbsp;升级前请一定要认真仔细的阅读下面的操作步骤及注意事项！！！" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td align=""right"" width=""180"" background=""http://www.powereasy.net/images/logo.gif"">&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr class=""tdbg"">" & vbCrLf
    Response.Write "    <td>" & vbCrLf
    Response.Write "      <table width=""90%"" align=""center"" height=""350"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td>" & vbCrLf
    Response.Write "            确定已了解下面的内容后，单击[下一步]继续。" & vbCrLf
    Response.Write "            <textarea rows=""21"" cols=""105"" style=""font-size: 9pt;"" readonly>"
    Response.Write " ●升级步骤：" & vbCrLf
    Response.Write " 1、必须使用全新安装的SiteWeaver6.6版数据库进行升级，没有添加任何栏目和信息！SQL版请运行install.asp安装好系统。" & vbCrLf
    Response.Write " 2、将本文件（Upgrade.asp）和动易2005版的数据库文件复制到动易SiteWeaver6.6版的安装目录下。" & vbCrLf
    Response.Write " 3、在浏览器中输入本文件的地址，如http://localhost/Upgrade.asp，运行本程序。" & vbCrLf
    Response.Write " 4、认真阅读本说明后点“下一步”，开始升级操作。" & vbCrLf
    Response.Write " 5、数据库升级成功后，您还需要完成以下工作（每一步都不能漏过）：" & vbCrLf
    Response.Write "   ①运行install.asp进行系统安装并配置相关网站信息。" & vbCrLf
    Response.Write "   ②后台——系统设置——网站信息配置，检查各项网站配置情况。" & vbCrLf
    Response.Write "   ③后台——系统设置——网站风格管理，将其中一个风格设为默认风格。即使不想改变默认风格，也需要做此步。" & vbCrLf
    Response.Write "   ④后台——各个频道——栏目管理，刷新栏目JS——专题管理，刷新专题JS——JS文件管理，刷新所有JS文件。" & vbCrLf
    Response.Write "   ⑤后台——系统设置——频道管理，如果有自定义的频道，请刷新频道文件，并检查各频道的参数设置情况。" & vbCrLf
    Response.Write "   ⑥将2005版中各频道的上传文件复制到SiteWeaver6.6版的相关频道中。" & vbCrLf
    Response.Write "   ⑦如果网站启用了生成HTML功能的，请重新生成所有页面。" & vbCrLf
    Response.Write " " & vbCrLf
    Response.Write " ●注意事项：" & vbCrLf
    Response.Write " 1、本升级程序只适用于官方发布版本的数据库升级，不适用于其他修改版或美化版的升级工作。" & vbCrLf
    Response.Write " 2、本操作不建议您直接在服务器上进行，最好在本地架起调试环境然后进行升级工作。" & vbCrLf
    Response.Write " 3、本操作的更新时间视您数据的多少以及服务器（或本地机器）的配置决定，如果数据很多，更新可能很慢。" & vbCrLf
    Response.Write " 4、升级过程中千万不能刷新页面或关闭浏览器，如果出现超时或者错误提示，请使用备份数据重新进行升级操作。" & vbCrLf
    Response.Write " 5、若您是直接在服务器进行升级，则操作成功完成后，一定要删除此文件！以免带来安全隐患。"
    Response.Write "</textarea>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "      <hr>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""30"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td align=""center"">" & vbCrLf
    Response.Write "            <input type=""hidden"" name=""Action"" value=""SelectDatabase"">" & vbCrLf
    Response.Write "            <input name=""Submit"" type=""submit"" value="" 下一步 "">" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  </form>" & vbCrLf
    Response.Write "</table>" & vbCrLf
End Sub

Sub SelectDatabase()
    Response.Write "<table width=""700"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"" class=""border"">" & vbCrLf
    Response.Write "  <form name=""myform"" method=""post"" action=""Upgrade.asp"">" & vbCrLf
    Response.Write "  <tr align=""center"" class=""topbg"">" & vbCrLf
    Response.Write "    <td height=""25""><strong>动易 2005版 To SiteWeaver6.6版 数据库升级程序</strong></td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr>" & vbCrLf
    Response.Write "    <td height=""60"" align=right>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""60"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""border-bottom: 1px solid #999999;"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td>" & vbCrLf
    Response.Write "            <strong>选择数据库：</strong><br>" & vbCrLf
    Response.Write "            &nbsp;&nbsp;请指定2005版使用的数据库类型及数据库名称或连接字符串。" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td align=""right"" width=""180"" background=""http://www.powereasy.net/images/logo.gif"">&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr class=""tdbg"">" & vbCrLf
    Response.Write "    <td>" & vbCrLf
    Response.Write "      <table width=""90%"" align=""center"" height=""350"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td valign=""top"">" & vbCrLf
    Response.Write "            <br>" & vbCrLf
    Response.Write "            如果2005版使用的数据库为 <font color=""blue"">ACCESS</font> 数据库，请将数据库文件复制到SiteWeaver6.6版目录中，并在下面的输入框中输入数据库文件名。<br>" & vbCrLf
    Response.Write "            如果2005版使用的数据库为 <font color=""blue"">SQL</font> 数据库，请确保可以连接上2005版数据库所在的服务器，并添写数据库连接字符串。<br>" & vbCrLf
    Response.Write "            添写完成后，单击[下一步]继续。<br>" & vbCrLf
    Response.Write "            <br>" & vbCrLf
    Response.Write "            <br>" & vbCrLf
    Response.Write "            <fieldset><legend>数据库连接</legend>" & vbCrLf
    Response.Write "            <table width=""650"" border=""0"" cellpadding=""10"" cellspacing=""5"">" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td><input type=""radio"" name=""db_type"" value=""ACCESS"" checked> ACCESS版数据库文件名：</td>" & vbCrLf
    Response.Write "                <td>" & vbCrLf
    Response.Write "                  <input name=""db_access"" type=""text"" value=""PowerEasy5.mdb"" size=""28"">" & vbCrLf
    Response.Write "                </td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td><input type=""radio"" name=""db_type"" value=""SQL""> SQL版数据库连接字符串：</td>" & vbCrLf
    Response.Write "                <td><textarea name=""db_sql"" cols=""55"" rows=""5"">Provider = Sqloledb; User ID = PowerEasy; Password = PowerEasy*9988; Initial Catalog = PowerEasy5; Data Source = (local);</textarea></td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "            </table>" & vbCrLf
    Response.Write "            </fieldset>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "      <hr>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""30"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td align=""center"">" & vbCrLf
    Response.Write "            <input name=""Action"" type=""hidden"" value=""SelectTable"">" & vbCrLf
    Response.Write "            <input name=""PrevStep"" type=""button"" value="" 上一步 "" onclick=""history.go(-1)"">" & vbCrLf
    Response.Write "            <input name=""Submit"" type=""submit"" value="" 下一步 "">" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  </form>" & vbCrLf
    Response.Write "</table>" & vbCrLf
End Sub

Function CheckDatabase()
    On Error Resume Next
    db_type = Trim(request("db_type"))
    CheckDatabase = False
    If db_type = "ACCESS" Then
        db_access = Trim(request("db_access"))
        If db_access = "" Then
            Response.Write "请输入动易2005 Access版的数据库文件名！"
            Exit Function
        End If
        Set Conn_Old = Server.CreateObject("ADODB.Connection")
        Conn_Old.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.mappath("" & db_access & "")
        Conn_Old.CommandTimeOut = 9999
        If Err.Number <> 0 Then
            Response.Write "数据库连接错误，请确认输入的动易2005 Access版的数据库文件名是否正确，且已经复制（或上传）到动易SiteWeaver6.6版所在目录。"
            Exit Function
        End If
    ElseIf db_type = "SQL" Then
        db_sql = Trim(request("db_sql"))
        If db_sql = "" Then
            Response.Write "请输入动易2005 SQL版的数据库连接字符串！"
            Exit Function
        End If
        Set Conn_Old = Server.CreateObject("ADODB.Connection")
        Conn_Old.open db_sql
        Conn_Old.CommandTimeOut = 9999
        If Err.Number <> 0 Then
            Response.Write "数据库连接错误，请确认输入的动易2005 SQL版的数据库连接字符串是否正确，特别是数据库服务器的IP地址。"
            Exit Function
        End If
    End If
    CheckDatabase = True
End Function

Sub SelectTable()
    If CheckDatabase() = False Then Exit Sub
    Response.Write "<table width=""700"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"" class=""border"">" & vbCrLf
    Response.Write "  <form name=""myform"" method=""post"" action=""Upgrade.asp"">" & vbCrLf
    Response.Write "  <tr align=""center"" class=""topbg"">" & vbCrLf
    Response.Write "    <td height=""25""><strong>动易 2005版 To SiteWeaver6.6版 数据库升级程序</strong></td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr>" & vbCrLf
    Response.Write "    <td height=""60"" align=right>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""60"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""border-bottom: 1px solid #999999;"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td>" & vbCrLf
    Response.Write "            <strong>选择数据项：</strong><br>" & vbCrLf
    Response.Write "            &nbsp;&nbsp;请选择要升级的数据库内容。" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td align=""right"" width=""180"" background=""http://www.powereasy.net/images/logo.gif"">&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr class=""tdbg"">" & vbCrLf
    Response.Write "    <td>" & vbCrLf
    Response.Write "      <table width=""90%"" align=""center"" height=""350"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td valign=""top"">" & vbCrLf

    Response.Write "            <br>" & vbCrLf
    Response.Write "            <br>" & vbCrLf
    Response.Write "            <fieldset><legend>选择升级内容</legend>" & vbCrLf
    Response.Write "            <table width=""650"" border=""0"" cellpadding=""0"" cellspacing=""8"">" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Config"" checked>网站配置</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Skin"" checked>网站风格</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Template"" checked>网站模板</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Channel"" checked>网站频道</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Class"" checked>网站栏目</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Special"" checked>所有专题</td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Article"" checked>所有文章</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Soft"" checked>所有软件</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Photo"" checked>所有图片</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Product"" checked>所有商品</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_GuestKind"" checked>留言类别</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_GuestBook"" checked>网站留言</td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Admin"" checked>网站管理员</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_UserGroup"" checked>用户组</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_User"" checked>会员记录</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Label"" checked>自定义标签</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Comment"" checked>评论</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_JsFile"" checked>ＪＳ数据</td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Announce"" checked>网站公告</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_AdZone"" checked>广告版位</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Advertisement"" checked>网站广告</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_FsKind"" checked>友情链接类别</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_FriendSite"" checked>友情链接</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Vote"" checked>网站调查</td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Author"" checked>作者</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_CopyFrom"" checked>来源</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_NewKeys"" checked>关键字</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Producer"" checked>生产商</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Trademark"" checked>商标</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_KeyLink"" checked>字符替换</td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Log"" checked>网站日志</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Favorite"" checked>用户收藏</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Message"" checked>短消息</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Classroom"" checked>室场记录</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Equipment"" checked>设备记录</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_UsedDetail"" checked>设备使用记录</td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Bank"" checked>银行帐户</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_BankrollItem"" checked>资金明细</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Card"" checked>充值卡</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_ConsumeLog"" checked>消费明细</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_OrderForm"" checked>订单</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_OrderFormItem"" checked>订单明细</td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_DeliverType"" checked>送货方式</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_DeliverItem"" checked>发退货记录</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Payment"" checked>在线支付记录</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_PaymentType"" checked>付款方式</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_PresentProject"" checked>促销方案</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_TransferItem"" checked>订单过户记录</td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Item"" checked>采集项目</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_Filters"" checked>采集过滤</td>" & vbCrLf
    Response.Write "                <td width=""16%""><input name=""UpdateTable"" type=""checkbox"" id=""UpdateTable"" value=""PE_HistrolyNews"" checked>采集历史记录</td>" & vbCrLf
    Response.Write "                <td width=""16%""> </td>" & vbCrLf
    Response.Write "                <td width=""16%""> </td>" & vbCrLf
    Response.Write "                <td width=""16%""> </td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "            </table>" & vbCrLf
    Response.Write "            </fieldset>" & vbCrLf

    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "      <hr>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""30"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td align=""center"">" & vbCrLf
    Response.Write "            <input name=""db_access"" type=""hidden"" value=""" & db_access & """>" & vbCrLf
    Response.Write "            <input name=""db_sql"" type=""hidden"" value=""" & db_sql & """>" & vbCrLf
    Response.Write "            <input name=""db_type"" type=""hidden"" value=""" & db_type & """>" & vbCrLf
    Response.Write "            <input name=""Action"" type=""hidden"" value=""Update"">" & vbCrLf
    Response.Write "            <input name=""PrevStep"" type=""button"" value="" 上一步 "" onclick=""history.go(-1)"">" & vbCrLf
    Response.Write "            <input name=""StartUpdate"" type=""submit"" value=""开始升级"">" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  </form>" & vbCrLf
    Response.Write "</table>" & vbCrLf
End Sub

Sub Update()
    BeginTime = Timer
    If CheckDatabase() = False Then Exit Sub

    UpdateTable = Trim(request("UpdateTable"))
    TotalRecordNum = 0
    If InStr(UpdateTable, ",") > 0 Then
        Dim arrUpdateTable, intTemp
        arrUpdateTable = Split(UpdateTable, ",")
        For intTemp = 0 To UBound(arrUpdateTable)
            TotalRecordNum = TotalRecordNum + GetRecordNum(Trim(arrUpdateTable(intTemp)))
        Next
    Else
        TotalRecordNum = GetRecordNum(Trim(UpdateTable))
    End If

    Response.Write "<table id=""Update_Table"" style=""display:"" width=""700"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"" class=""border"">" & vbCrLf
    Response.Write "  <form name=""myform"" method=""post"" action=""Upgrade.asp"">" & vbCrLf
    Response.Write "  <tr align=""center"" class=""topbg"">" & vbCrLf
    Response.Write "    <td height=""25""><strong>动易 2005版 To SiteWeaver6.6版 数据库升级程序</strong></td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr>" & vbCrLf
    Response.Write "    <td height=""60"" align=right>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""60"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""border-bottom: 1px solid #999999;"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td>" & vbCrLf
    Response.Write "            <strong>正在升级：</strong><br>" & vbCrLf
    Response.Write "            &nbsp;&nbsp;升级过程中请勿刷新页面或关闭窗口！</font><br>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td align=""right"" width=""180"" background=""http://www.powereasy.net/images/logo.gif"">&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr class=""tdbg"">" & vbCrLf
    Response.Write "    <td>" & vbCrLf
    Response.Write "      <table width=""90%"" align=""center"" height=""350"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td valign=""top"">" & vbCrLf
    Response.Write "            <fieldset><legend>升级进度</legend>" & vbCrLf
    Response.Write "              <table border=""0"" cellspacing=""1"" cellpadding=""1"">" & vbCrLf
    Response.Write "                <tr>" & vbCrLf
    Response.Write "                  <td>" & vbCrLf
    Response.Write "                    <table width=""634"">" & vbCrLf
    Response.Write "                      <tr>" & vbCrLf
    Response.Write "                        <td width=""240"">当前进度：<span id=""Info_CurrentPercent"" name=""Info_CurrentPercent"">0</span>%</td>" & vbCrLf
    Response.Write "                        <td><span id=""Info_CurrentUpdate"">123</span></td>" & vbCrLf
    Response.Write "                        <td align=""right""><span id=""Info_CurrentRecord"" name=""Info_CurrentRecord""></span></td>" & vbCrLf
    Response.Write "                      </tr>" & vbCrLf
    Response.Write "                    </table>" & vbCrLf
    Response.Write "                    <table width=""634"" height=""20"" border=""0"" cellspacing=""1"" cellpadding=""1"" bgcolor=""#000000"" align=""center"">" & vbCrLf
    Response.Write "                      <tr>" & vbCrLf
    Response.Write "                        <td bgcolor=""#ffffff"">" & vbCrLf
    Response.Write "                          <table name=""PercentBar"" id=""PercentBar"" width=""0"" height=""18"" bgcolor=""green"" border=""0"" cellspacing=""0"" cellpadding=""0""><tr><td></td></tr></table>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                      </tr>" & vbCrLf
    Response.Write "                    </table>" & vbCrLf
    Response.Write "                    <br>" & vbCrLf
    Response.Write "                    <table width=""634"">" & vbCrLf
    Response.Write "                      <tr>" & vbCrLf
    Response.Write "                        <td>总体进度：<span id=""Info_TotalPercent"" name=""Info_TotalPercent"">0</span>%</td>" & vbCrLf
    Response.Write "                        <td align=""right""><span id=""Info_TotalRecord"" name=""Info_TotalRecord""></span></td>" & vbCrLf
    Response.Write "                      </tr>" & vbCrLf
    Response.Write "                    </table>" & vbCrLf
    Response.Write "                    <table width=""634"" height=""20"" border=""0"" cellspacing=""1"" cellpadding=""1"" bgcolor=""#000000"" align=""center"">" & vbCrLf
    Response.Write "                      <tr>" & vbCrLf
    Response.Write "                        <td bgcolor=""#ffffff"">" & vbCrLf
    Response.Write "                          <table name=""TotalPercentBar"" id=""TotalPercentBar"" width=""0"" height=""18"" bgcolor=""blue"" border=""0"" cellspacing=""0"" cellpadding=""0""><tr><td></td></tr></table>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                      </tr>" & vbCrLf
    Response.Write "                    </table>" & vbCrLf
    Response.Write "                    <br>" & vbCrLf
    Response.Write "                  </td>" & vbCrLf
    Response.Write "                </tr>" & vbCrLf
    Response.Write "              </table>" & vbCrLf
    Response.Write "            </fieldset>" & vbCrLf
    Response.Write "            <br>" & vbCrLf
    Response.Write "            <textarea id='UpdateInfo' rows=""11"" cols=""105"" style=""font-size: 9pt;"" readonly></textarea>" & vbCrLf

    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "      <hr>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""30"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td align=""center"">" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  </form>" & vbCrLf
    Response.Write "</table>" & vbCrLf

    Response.Write "<table id=""Success_Table"" style=""display:none"" width=""700"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"" class=""border"">" & vbCrLf
    Response.Write "  <form name=""myform"" method=""post"" action=""Upgrade.asp"">" & vbCrLf
    Response.Write "  <tr align=""center"" class=""topbg"">" & vbCrLf
    Response.Write "    <td height=""25""><strong>动易 2005版 To SiteWeaver6.6版 数据库升级程序</strong></td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr>" & vbCrLf
    Response.Write "    <td height=""60"" align=right>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""60"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""border-bottom: 1px solid #999999;"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td>" & vbCrLf
    Response.Write "            <strong>升级完成：</strong><br>" & vbCrLf
    Response.Write "            &nbsp;&nbsp;成功将动易2005版数据库升级至SiteWeaver6.6版！</font><br>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td align=""right"" width=""180"" background=""http://www.powereasy.net/images/logo.gif"">&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr class=""tdbg"">" & vbCrLf
    Response.Write "    <td>" & vbCrLf
    Response.Write "      <table width=""90%"" align=""center"" height=""350"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td valign=""top"">" & vbCrLf
    Response.Write "            <br>" & vbCrLf
    Response.Write "            恭喜您，从动易2005版的数据库升级到动易SiteWeaver6.6版成功！！！<br>" & vbCrLf
    Response.Write "            共耗时：<span id=""Info_Timer""></span>秒。<br>" & vbCrLf
    Response.Write "            <font color=red>若您是直接在服务器进行升级，则请立即删除此文件！以免带来安全隐患。</font><br><br>" & vbCrLf
    Response.Write "            您还需要继续完成以下工作："
    Response.Write "            <br>①运行install.asp进行系统安装并配置相关网站信息。" & vbCrLf
    Response.Write "            <br>②后台——系统设置——网站信息配置，检查各项网站配置情况。" & vbCrLf
    Response.Write "            <br>③后台——系统设置——网站风格管理，将其中一个风格设为默认风格。即使不想改变默认风格，也需要做此步。" & vbCrLf
    Response.Write "            <br>④后台——各个频道——栏目管理，刷新栏目JS——专题管理，刷新专题JS——JS文件管理，刷新所有JS文件。" & vbCrLf
    Response.Write "            <br>⑤后台——系统设置——频道管理，如果有自定义的频道，请刷新频道文件，并检查各频道的参数设置情况。" & vbCrLf
    Response.Write "            <br>⑥将2005版中各频道的上传文件复制到SiteWeaver6.6版的相关频道中。" & vbCrLf
    Response.Write "            <br>⑦如果网站启用了生成HTML功能的，请重新生成所有页面。" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "      <hr>" & vbCrLf
    Response.Write "      <table width=""100%"" height=""30"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
    Response.Write "        <tr>" & vbCrLf
    Response.Write "          <td align=""center"">" & vbCrLf
    Response.Write "            <input type=""hidden"" name=""Action"" value=""SelectDatabase"">" & vbCrLf
    Response.Write "            <input name=""delfile"" type=""button"" value="" 删除此程序 "" onclick=""location='Upgrade.asp?Action=Del'"">" & vbCrLf
    Response.Write "            <input name=""close"" type=""button"" value="" 关闭此窗口 "" onclick=""javascript:onclick=window.close()"">" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>"
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  </form>" & vbCrLf
    Response.Write "</table>" & vbCrLf


    Call Update_Preview
    Call Update_PE_Field

    If FoundInArr(UpdateTable, "PE_Config") = True Then Call Update_Table("PE_Config", "", "ShowRunTime,SessionTimeout,RegPresent,MoneyExchangePoint,Watermark_Text_Position", "网站配置")
    If FoundInArr(UpdateTable, "PE_Skin") = True Then Call Update_PE_Skin
    If FoundInArr(UpdateTable, "PE_Template") = True Then Call Update_PE_Template
    If FoundInArr(UpdateTable, "PE_Class") = True Then Call Update_Table("PE_Class", "ClassID", "Setting,SkinID,TemplateID", "网站栏目")
    If FoundInArr(UpdateTable, "PE_Special") = True Then Call Update_Table("PE_Special", "SpecialID", "SkinID,TemplateID", "所有专题")

    If FoundInArr(UpdateTable, "PE_Article") = True Then Call Update_Table("PE_Article", "ArticleID", "Author,CopyFrom,SpecialID,Hot,Passed,ReadPoint,SkinID,TemplateID", "所有文章")
    If FoundInArr(UpdateTable, "PE_Soft") = True Then Call Update_Table("PE_Soft", "SoftID", "Author,CopyFrom,SpecialID,Passed,SoftPoint,Copymoney,IsPayed,Beneficiary,SkinID,TemplateID", "所有软件")
    If FoundInArr(UpdateTable, "PE_Photo") = True Then Call Update_Table("PE_Photo", "PhotoID", "Author,CopyFrom,SpecialID,Passed,PhotoPoint,Copymoney,IsPayed,Beneficiary,SkinID,TemplateID", "所有图片")
    If FoundInArr(UpdateTable, "PE_Product") = True Then Call Update_Table("PE_Product", "ProductID", "SpecialID,SkinID,TemplateID", "所有商品")
    If FoundInArr(UpdateTable, "PE_GuestKind") = True Then Call Update_Table("PE_GuestKind", "KindID", "", "留言类别")
    If FoundInArr(UpdateTable, "PE_GuestBook") = True Then Call Update_Table("PE_GuestBook", "GuestID", "LastReplyTime,GuestReplyDatetime", "留言")

    If FoundInArr(UpdateTable, "PE_Admin") = True Then Call Update_Table("PE_Admin", "ID", "ID", "网站管理员")
    If FoundInArr(UpdateTable, "PE_UserGroup") = True Then Call Update_Table("PE_UserGroup", "GroupID", "", "用户组")
    If FoundInArr(UpdateTable, "PE_Label") = True Then Call Update_Table("PE_Label", "LabelID", "LabelID,Config", "自定义标签")
    If FoundInArr(UpdateTable, "PE_Comment") = True Then Call Update_Table("PE_Comment", "CommentID", "CommentID,ChannelID,ClassID", "评论")
    If FoundInArr(UpdateTable, "PE_JsFile") = True Then Call Update_Table("PE_JsFile", "ID", "ID", "JS代码")

    If FoundInArr(UpdateTable, "PE_Announce") = True Then Call Update_Table("PE_Announce", "ID", "ID", "网站公告")
    If FoundInArr(UpdateTable, "PE_AdZone") = True Then Call Update_Table("PE_AdZone", "ZoneID", "", "广告版位")
    If FoundInArr(UpdateTable, "PE_Advertisement") = True Then Call Update_Table("PE_Advertisement", "ADID", "", "网站广告")
    If FoundInArr(UpdateTable, "PE_FsKind") = True Then Call Update_Table("PE_FsKind", "KindID", "", "友情链接类别")
    If FoundInArr(UpdateTable, "PE_FriendSite") = True Then Call Update_Table("PE_FriendSite", "ID", "ID", "友情链接")
    If FoundInArr(UpdateTable, "PE_Vote") = True Then Call Update_Table("PE_Vote", "ID", "ID", "网站调查")

    If FoundInArr(UpdateTable, "PE_Author") = True Then Call Update_Table("PE_Author", "ID", "ID,UserName,NiceName,TemplateID", "作者")
    If FoundInArr(UpdateTable, "PE_CopyFrom") = True Then Call Update_Table("PE_CopyFrom", "ID", "ID", "来源")
    If FoundInArr(UpdateTable, "PE_NewKeys") = True Then Call Update_Table("PE_NewKeys", "ID", "ID", "关键字")
    If FoundInArr(UpdateTable, "PE_Producer") = True Then Call Update_Table("PE_Producer", "ProducerID", "ProducerID", "生产商")
    If FoundInArr(UpdateTable, "PE_Trademark") = True Then Call Update_Table("PE_Trademark", "TrademarkID", "TrademarkID", "商标")
    If FoundInArr(UpdateTable, "PE_KeyLink") = True Then Call Update_Table("PE_KeyLink", "ID", "ID", "字符替换")

    If FoundInArr(UpdateTable, "PE_Log") = True Then Call Update_Table("PE_Log", "LogID", "LogID", "网站日志")
    If FoundInArr(UpdateTable, "PE_Favorite") = True Then Call Update_Table("PE_Favorite", "ID", "ID", "用户收藏")
    If FoundInArr(UpdateTable, "PE_Message") = True Then Call Update_Table("PE_Message", "ID", "ID", "短消息")
    If FoundInArr(UpdateTable, "PE_Classroom") = True Then Call Update_Table("PE_Classroom", "ID", "ID", "室场记录")
    If FoundInArr(UpdateTable, "PE_Equipment") = True Then Call Update_Table("PE_Equipment", "ID", "ID", "设备记录")
    If FoundInArr(UpdateTable, "PE_UsedDetail") = True Then Call Update_Table("PE_UsedDetail", "ID", "ID", "设备使用记录")

    If FoundInArr(UpdateTable, "PE_Bank") = True Then Call Update_Table("PE_Bank", "BankID", "", "银行帐户")
    If FoundInArr(UpdateTable, "PE_BankrollItem") = True Then Call Update_Table("PE_BankrollItem", "ItemID", "ItemID,UserID", "资金明细")
    If FoundInArr(UpdateTable, "PE_Card") = True Then Call Update_Table("PE_Card", "CardID", "CardID", "充值卡")
    If FoundInArr(UpdateTable, "PE_ConsumeLog") = True Then Call Update_Table("PE_ConsumeLog", "LogID", "LogID,ChannelID", "消费明细")
    If FoundInArr(UpdateTable, "PE_OrderForm") = True Then Call Update_Table("PE_OrderForm", "OrderFormID", "UserID", "订单")
    If FoundInArr(UpdateTable, "PE_OrderFormItem") = True Then Call Update_Table("PE_OrderFormItem", "ItemID", "", "订单明细")

    If FoundInArr(UpdateTable, "PE_DeliverType") = True Then Call Update_Table("PE_DeliverType", "TypeID", "Charge", "送货方式")
    If FoundInArr(UpdateTable, "PE_DeliverItem") = True Then Call Update_Table("PE_DeliverItem", "DeliverID", "DeliverID", "发退货记录")
    If FoundInArr(UpdateTable, "PE_PaymentType") = True Then Call Update_Table("PE_PaymentType", "TypeID", "", "付款方式")
    If FoundInArr(UpdateTable, "PE_Payment") = True Then Call Update_Table("PE_Payment", "PaymentID", "UserID", "在线支付记录")
    If FoundInArr(UpdateTable, "PE_PresentProject") = True Then Call Update_Table("PE_PresentProject", "ProjectID", "ProjectID", "促销方案")
    If FoundInArr(UpdateTable, "PE_TransferItem") = True Then Call Update_Table("PE_TransferItem", "ItemID", "ItemID", "订单过户记录")

    If FoundInArr(UpdateTable, "PE_Item") = True Then Call Update_Table("PE_Item", "ItemID", "ItemID,SpecialID,ReadPoint,CollecOrder,Passed", "采集项目")
    If FoundInArr(UpdateTable, "PE_Filters") = True Then Call Update_Table("PE_Filters", "FilterID", "FilterID", "采集过滤")
    If FoundInArr(UpdateTable, "PE_HistrolyNews") = True Then Call Update_Table("PE_HistrolyNews", "HistrolyNewsID", "HistrolyNewsID", "采集历史记录")

    If FoundInArr(UpdateTable, "PE_Channel") = True Then Call Update_Table("PE_Channel", "ChannelID", "ShowMyStyle,EnableCheck,DefaultSkinID,Template_Index", "网站频道")
    If FoundInArr(UpdateTable, "PE_User") = True Then Call Update_PE_User

    Call Update_66
    Call DelAllCache
    Conn_Old.Close
    Set Conn_Old = Nothing


    Response.Write "<script>" & vbCrLf
    Response.Write "Info_CurrentUpdate.innerHTML=""<font color='blue'>数据库升级成功！</font>"";" & vbCrLf
    Response.Write "Info_Timer.innerHTML=""" & FormatNumber((Timer - BeginTime), 3) & """;" & vbCrLf
    Response.Write "Update_Table.style.display='none';" & vbCrLf
    Response.Write "Success_Table.style.display='';" & vbCrLf
    Response.Write "</script>" & vbCrLf


End Sub

Sub Del()
    On Error Resume Next
    If fso.FileExists(Server.mappath("Upgrade.asp")) Then
        fso.DeleteFile Server.mappath("Upgrade.asp")
    End If
    If Err.Number <> 0 Then
        ErrMsg = ErrMsg & "<br><li>删除升级程序（Upgrade.asp）失败，错误原因：" & Err.Description & "<br>请手动删除此文件。"
        Err.Clear
        Exit Sub
    Else
        Response.Write "<li>删除升级程序（Upgrade.asp）成功！</li>"
    End If
End Sub

Sub Update_Preview()  '对原2005版的数据库进行预处理
    On Error Resume Next
    Dim rsChannel
    Set rsChannel = Conn_Old.Execute("select ChannelDir from PE_Channel where ChannelType=1 Order by ChannelID Asc")
    Do While Not rsChannel.EOF
        If SystemDatabaseType = "SQL" Then
            Conn.Execute ("alter table PE_Admin add AdminPurview_" & rsChannel("ChannelDir") & " Int null")
        Else
            Conn.Execute ("alter table PE_Admin add COLUMN AdminPurview_" & rsChannel("ChannelDir") & " INTEGER")
        End If
        rsChannel.movenext
    Loop
    rsChannel.Close
    Set rsChannel = Nothing
End Sub

Sub Update_PE_Field()
    On Error Resume Next
    Dim SheetName, FieldName, sqlField
    rsOld.open "select F.FieldID,F.ChannelID,F.FieldName,F.Title,F.LabelName,F.Tips,F.FieldType,F.DefaultValue,F.Options,F.EnableNull,F.ShowOnForm,F.FieldLevel,C.ModuleType from PE_Field F inner join PE_Channel C on F.ChannelID=C.ChannelID Order by F.ChannelID asc,F.FieldID Asc", Conn_Old, 1, 1
    rsNew.open "select * from PE_Field", Conn, 1, 3
    Do While Not rsOld.EOF
        Select Case rsOld("ModuleType")
        Case 1
            SheetName = "PE_Article"
        Case 2
            SheetName = "PE_Soft"
        Case 3
            SheetName = "PE_Photo"
        Case 5
            SheetName = "PE_Product"
        End Select
            
        FieldName = rsOld("FieldName")
        If SystemDatabaseType = "SQL" Then
            If rsOld("FieldType") = 2 Then
                sqlField = "alter table " & SheetName & " add " & FieldName & " ntext null"
            Else
                sqlField = "alter table " & SheetName & " add " & FieldName & " nvarchar(255) null"
            End If
        Else
            If rsOld("FieldType") = 2 Then
                sqlField = "alter table " & SheetName & " add " & FieldName & " text null"
            Else
                sqlField = "alter table " & SheetName & " add " & FieldName & " varchar(255) null"
            End If
        End If
        Conn.Execute (sqlField)
        If Err Then
            Err.Clear
            Response.Write "<br><li>向 " & SheetName & " 表中添加自定义字段 " & FieldName & " 失败！</li>"
        Else
            rsNew.addnew
            rsNew("ChannelID") = rsOld("ChannelID") & ""
            rsNew("FieldName") = rsOld("FieldName")
            rsNew("Title") = rsOld("Title")
            rsNew("LabelName") = rsOld("LabelName")
            rsNew("Tips") = rsOld("Tips")
            rsNew("FieldType") = rsOld("FieldType")
            rsNew("DefaultValue") = rsOld("DefaultValue")
            rsNew("Options") = rsOld("Options")
            rsNew("EnableNull") = rsOld("EnableNull")
            rsNew("ShowOnForm") = rsOld("ShowOnForm")
            rsNew("FieldLevel") = rsOld("FieldLevel")
            rsNew.Update
        End If

        rsOld.movenext
    Loop
    rsOld.Close
    rsNew.Close
End Sub

Sub Update_PE_Skin()
    Dim maxrs
    TableName = "PE_Skin"
    Info_CurrentUpdate = "正在升级网站风格"
    RecordNum = GetRecordNum(TableName)
    RecordIndex = 0
    Call RefreshPercentBar(True)
    rsOld.open "select * from PE_Skin Order by SkinID Asc", Conn_Old, 1, 1
    If Not (rsOld.EOF And rsOld.bof) Then
        ReDim ArrSkinID(rsOld.recordcount - 1, 1)
        i = 0
    End If
    rsNew.open "select * from PE_Skin", Conn, 1, 3
    Do While Not rsOld.EOF
        If i = 0 Then
            Conn.Execute ("update PE_Skin set IsDefault=" & PE_False & "")
        End If
        rsNew.addnew
        rsNew("SkinName") = rsOld("SkinName")
        rsNew("IsDefault") = False
        If rsOld("IsDefault") = True Then
            rsNew("IsDefaultInProject") = True
        Else
            rsNew("IsDefaultInProject") = False
        End If
        rsNew("Skin_CSS") = rsOld("Skin_CSS") & AppendSkinCss()
        rsNew("ProjectName") = "原2005版模板方案"
        rsNew.Update

        Set maxrs = Conn.Execute("select max(SkinID) from PE_Skin")
        If Not IsNull(maxrs(0)) Then
            ArrSkinID(i, 0) = rsOld("SkinID")
            ArrSkinID(i, 1) = maxrs(0)
        End If
        Set maxrs = Nothing
        i = i + 1

        rsOld.movenext
        RecordIndex = RecordIndex + 1
        If (RecordIndex Mod 10) = 0 Then
            Call RefreshPercentBar(True)
        End If
        TotalRecordIndex = TotalRecordIndex + 1
        If Response.IsClientConnected = False Then Exit Do
    Loop
    rsOld.Close
    rsNew.Close
    Call RefreshPercentBar(False)
End Sub

Sub Update_PE_Template()
    Dim maxrs
    TableName = "PE_Template"
    Info_CurrentUpdate = "正在升级网站模板"
    RecordNum = GetRecordNum(TableName)
    RecordIndex = 0
    Call RefreshPercentBar(True)
    rsOld.open "select * from PE_Template Order by ChannelID Asc,TemplateID Asc", Conn_Old, 1, 1
    If Not (rsOld.EOF And rsOld.bof) Then
        ReDim ArrTemplateID(rsOld.recordcount - 1, 1)
        i = 0
    End If
    rsNew.open "select * from PE_Template", Conn, 1, 3
    Do While Not rsOld.EOF
        rsNew.addnew
        rsNew("ChannelID") = rsOld("ChannelID")
        rsNew("TemplateName") = rsOld("TemplateName")
        rsNew("TemplateType") = rsOld("TemplateType")
        rsNew("TemplateContent") = rsOld("TemplateContent")
        rsNew("IsDefault") = False
        rsNew("ProjectName") = "原2005版模板方案"
        If rsOld("IsDefault") = True Then
            rsNew("IsDefaultInProject") = True
        Else
            rsNew("IsDefaultInProject") = False
        End If
        rsNew("Deleted") = False
        rsNew.Update

        Set maxrs = Conn.Execute("select max(TemplateID) from PE_Template")
        If Not IsNull(maxrs(0)) Then
            ArrTemplateID(i, 0) = rsOld("TemplateID")
            ArrTemplateID(i, 1) = maxrs(0)
        End If
        Set maxrs = Nothing
        i = i + 1

        rsOld.movenext
        RecordIndex = RecordIndex + 1
        If (RecordIndex Mod 10) = 0 Then
            Call RefreshPercentBar(True)
        End If
        TotalRecordIndex = TotalRecordIndex + 1
    Loop
    rsOld.Close
    rsNew.Close

    Conn.Execute ("update PE_TemplateProject set IsDefault=" & PE_False & " where IsDefault=" & PE_True & "")
    Conn.Execute ("Insert into PE_TemplateProject(TemplateProjectID,TemplateProjectName,Intro,IsDefault) values (1001,'原2005版模板方案','原2005版模板方案'," & PE_True & ")")


    '定义风格系统默认
    Conn.Execute ("update PE_Skin set IsDefault=" & PE_False & " where IsDefault=" & PE_True & "")
    Conn.Execute ("update PE_Skin set IsDefault=" & PE_True & " where IsDefaultInProject=" & PE_True & " and ProjectName='原2005版模板方案'")
    '定义模板系统默认
    Conn.Execute ("update PE_Template set IsDefault=" & PE_False & " where IsDefault=" & PE_True & "")
    Conn.Execute ("update PE_Template set IsDefault=" & PE_True & " where IsDefaultInProject=" & PE_True & " and ProjectName='原2005版模板方案'")
    '定义方案系统默认
    Conn.Execute ("update PE_TemplateProject set IsDefault=" & PE_False & " where IsDefault=" & PE_True & "")
    Conn.Execute ("update PE_TemplateProject set IsDefault=" & PE_True & " where TemplateProjectName='原2005版模板方案'")

    Call RefreshPercentBar(False)
End Sub

Sub Update_Table(TableName, strOrder, ExcludeField, strUpdate)
    On Error Resume Next
    Dim Flag
    Info_CurrentUpdate = "正在升级" & strUpdate
    RecordNum = GetRecordNum(TableName)
    RecordIndex = 0
    Call RefreshPercentBar(True)
    If FoundInArr("PE_Config,PE_Label", TableName) = False Then
        If TableName = "PE_Channel" Then
            Conn.Execute ("delete from " & TableName & " where ChannelID<>997 and ChannelID<>998 and ChannelID<>999")
        Else
            Conn.Execute ("delete from " & TableName)
        End If
    End If
    If Trim(strOrder) = "" Then
        rsOld.open "select * from " & TableName, Conn_Old, 1, 1
    Else
        rsOld.open "select * from " & TableName & " Order by " & strOrder & " asc", Conn_Old, 1, 1
    End If

    rsNew.open "select * from " & TableName, Conn, 1, 3
    Do While Not rsOld.EOF
        If FoundInArr("PE_Config", TableName) = False Then
            rsNew.addnew
        End If
        For i = 0 To rsOld.Fields.Count - 1
            If FoundInArr(ExcludeField, rsOld.Fields(i).Name) = False Then
                Flag = True
                If FoundInArr("PE_Article,PE_Photo,PE_Product,PE_Soft", TableName) = True And InStr(rsOld.Fields(i).Name, "MY_") > 0 Then
                    If Not (CheckExistField(rsOld.Fields(i).Name, rsOld("ChannelID"))) Then
                        Flag = False
                    End If
                End If
                If FoundInArr("PE_Admin", TableName) = True And InStr(rsOld.Fields(i).Name, "AdminPurview_") > 0 Then
                    If Not (CheckAdminExistField(rsOld.Fields(i).Name)) Then
                        Flag = False
                    End If
                End If
                If Flag = True Then
                    Select Case rsOld.Fields(i).Type
                    Case 3, 4, 5, 6, 17 '数值
                        If IsNumeric(rsOld(rsOld.Fields(i).Name).Value) Then
                            rsNew(rsOld.Fields(i).Name) = rsOld(rsOld.Fields(i).Name)
                        Else
                            rsNew(rsOld.Fields(i).Name) = 0
                        End If
                    Case 11 '布尔
                        If IsNull(rsOld(rsOld.Fields(i).Name).Value) Then
                            rsNew(rsOld.Fields(i).Name) = False
                        Else
                            rsNew(rsOld.Fields(i).Name) = CBool(rsOld(rsOld.Fields(i).Name))
                        End If
                    Case 7, 135 '日期
                        If IsDate(rsOld(rsOld.Fields(i).Name).Value) Then
                            rsNew(rsOld.Fields(i).Name) = rsOld(rsOld.Fields(i).Name)
                        Else
                            rsNew(rsOld.Fields(i).Name) = Now()
                        End If
                    Case 202, 203 '文本、备注
                        rsNew(rsOld.Fields(i).Name) = rsOld(rsOld.Fields(i).Name) & ""
                    Case Else
                        rsNew(rsOld.Fields(i).Name) = rsOld(rsOld.Fields(i).Name)
                    End Select
            
                End If
                
                If Err.Number <> 0 Then
                    Response.Write "<br><br>出 错 表：" & TableName
                    Response.Write "<br>出错字段：" & rsOld.Fields(i).Name
                    Response.Write "<br>出错记录：" & RecordIndex
                    Response.Write "<br>出错内容：" & rsOld(rsOld.Fields(i).Name)
                    Response.Write "<br>错 误 号：" & Err.Number
                    Response.Write "<br>错误描述：" & Err.Description
                    Response.Write "<br>错误来源：" & Err.Source & "<br>"
                    Err.Clear
                    Response.End
                End If
            End If
        Next

        Select Case TableName
        Case "PE_AdZone"
            rsNew("ZoneJsName") = Year(rsOld("UpdateTime")) & Right("0" & Month(rsOld("UpdateTime")), 2) & "/" & rsOld("ZoneID") & ".js"
        Case "PE_Admin"
            rsNew("RoleName") = ""
            rsNew("AdminPurview_GuestBook") = 0
            rsNew("AdminPurview_Supply") = 0
            rsNew("AdminPurview_House") = 0
            rsNew("AdminPurview_Job") = 0
            rsNew("arrClass_GuestBook") = ""
            rsNew("Count_Add") = 0
            rsNew("Count_Check") = 0
            rsNew("Count_Reject") = 0
        Case "PE_Announce"
            rsNew("OutTime") = 0
        Case "PE_Author"
            rsNew("IsElite") = False
            rsNew("onTop") = False
            rsNew("Hits") = 0
        Case "PE_Card"
            rsNew("AgentName") = ""
        Case "PE_Class"
            rsNew("SkinID") = GetNewID(ArrSkinID, rsOld("SkinID"))
            rsNew("TemplateID") = GetNewID(ArrTemplateID, rsOld("TemplateID"))
            rsNew("Tips") = rsOld("Readme")
            rsNew("Meta_Keywords") = ""
            rsNew("Meta_Description") = ""
            rsNew("DefaultItemPoint") = 0
            rsNew("DefaultItemChargeType") = 0
            rsNew("DefaultItemPitchTime") = 24
            rsNew("DefaultItemReadTimes") = 10
            rsNew("DefaultItemDividePercent") = 0
            'rsNew("CommandClassPoint") = 0
            'rsNew("ReleaseClassPoint") = 0
        Case "PE_Comment"
            rsNew("ModuleType") = rsOld("ChannelID")
        Case "PE_CopyFrom"
            rsNew("Passed") = True
            rsNew("onTop") = False
            rsNew("IsElite") = False
            rsNew("Hits") = 0
        Case "PE_GuestBook"
            rsNew("ReplyIsPrivate") = False
            rsNew("GuestContentLength") = Len(rsOld("GuestContent"))
            If IsDate(rsOld("LastReplyTime")) Then rsNew("LastReplyTime") = rsOld("LastReplyTime")
            If IsDate(rsOld("GuestReplyDatetime")) Then rsNew("GuestReplyDatetime") = rsOld("GuestReplyDatetime")
        Case "PE_Producer"
            rsNew("Passed") = True
            rsNew("onTop") = False
            rsNew("IsElite") = False
            rsNew("Hits") = 0
        Case "PE_Trademark"
            rsNew("Passed") = True
            rsNew("onTop") = False
            rsNew("Hits") = 0
        Case "PE_Product"
            rsNew("SkinID") = GetNewID(ArrSkinID, rsOld("SkinID"))
            rsNew("TemplateID") = GetNewID(ArrTemplateID, rsOld("TemplateID"))
            rsNew("BarCode") = ""
            rsNew("CommentCount") = 0
            rsNew("CreateTime") = PE_CDate(rsOld("UpdateTime"))
            rsNew("VoteID") = 0
            rsNew("PresentMoney") = 0
            rsNew("PresentPoint") = 0
            rsNew("Weight") = 0
            If rsOld("ProductType") = 4 Then
                rsNew("EnableSingleSell") = False
            Else
                rsNew("EnableSingleSell") = True
            End If
            rsNew("DependentProducts") = ""
            Conn.Execute ("insert into PE_InfoS (ModuleType,ItemID,SpecialID) values (5," & rsOld("ProductID") & "," & rsOld("SpecialID") & ")")
        Case "PE_UsedDetail"
            rsNew("LessonInfo") = ""
        Case "PE_Item"
            rsNew("SpecialID") = "" '原数字变文本 新增可空
            rsNew("KeyScatterNum") = 2
            rsNew("InfoPoint") = 0 'ReadPoint转化
            rsNew("AddThumb") = False
            rsNew("CollecOrder") = 0
            rsNew("Status") = GetStatusByPassed(rsOld("Passed"))
            rsNew("ThumbnailType") = 0
            rsNew("ThsString") = ""
            rsNew("ThoString") = ""
            rsNew("PsString") = ""
            rsNew("PoString") = ""
            rsNew("PhsString") = ""
            rsNew("PhoString") = ""
            rsNew("IsString") = ""
            rsNew("IoString") = ""
            rsNew("IntroType") = 0
            rsNew("IntroStr") = ""
            rsNew("IntroNum") = 100
            rsNew("IsField") = 0
            rsNew("Field") = ""
            rsNew("InfoPurview") = 0
            rsNew("arrGroupID") = ""
            rsNew("ChargeType") = 0
            rsNew("PitchTime") = 0
            rsNew("ReadTimes") = 0
            rsNew("DividePercent") = 0
            rsNew("SaveFlashUrlToFile") = False
        Case "PE_KeyLink"
            rsNew("OpenType") = 0
            rsNew("ReplaceType") = 0
            rsNew("Priority") = 0
        Case "PE_Label"
            rsNew("AreaCollectionID") = 0
        Case "PE_Vote"
            rsNew("EndTime") = Now() + 30
            rsNew("IsItem") = False
        Case "PE_BankrollItem"
            rsNew("UserName") = "PE$$$" & rsOld("UserID") '先直接引用原来的UserID，稍后在转化会员时再转化
            rsNew("ClientID") = 0
            'rsNew("LogTime") =
            rsNew("Inputer") = "升级程序"
            rsNew("IP") = ""
        Case "PE_ConsumeLog"
            rsNew("ModuleType") = rsOld("ChannelID")
            rsNew("Times") = 1
            rsNew("IP") = ""
            rsNew("Inputer") = "升级程序"
        Case "PE_DeliverType"
            rsNew("ChargeType") = 0
            rsNew("ReleaseType") = 0
            rsNew("ReleaseCharge") = 10
            rsNew("MaxCharge") = 100
            rsNew("MinMoney1") = 1000
            rsNew("MinMoney2") = 5000
            rsNew("MinMoney3") = 10000
        Case "PE_OrderForm"
            rsNew("UserName") = "PE$$$" & rsOld("UserID") '先直接引用原来的UserID，稍后在转化会员时再转化
            rsNew("ClientID") = 0
            rsNew("AgentName") = ""
            rsNew("Mobile") = ""
            rsNew("PresentPoint") = 0
        Case "PE_OrderFormItem"
            rsNew("PresentMoney") = 0
            rsNew("PresentPoint") = 0
        Case "PE_Payment"
            rsNew("UserName") = "PE$$$" & rsOld("UserID")  '先直接引用原来的UserID，稍后在转化会员时再转化
        Case "PE_PresentProject"
            rsNew("PresentPoint") = 0
        Case "PE_Special"
            rsNew("SkinID") = GetNewID(ArrSkinID, rsOld("SkinID"))
            rsNew("TemplateID") = GetNewID(ArrTemplateID, rsOld("TemplateID"))
            rsNew("OpenType") = 0
            rsNew("SpecialPicUrl") = ""
            rsNew("Tips") = ""
            rsNew("MaxPerPage") = 20
            rsNew("IsElite") = False
        Case "PE_Channel"
            Conn.Execute ("update PE_Comment set ModuleType=" & PE_CLng(rsOld("ModuleType")) & " where ModuleType=" & rsOld("ChannelID") & "")
            Conn.Execute ("update PE_ConsumeLog set ModuleType=" & PE_CLng(rsOld("ModuleType")) & " where ModuleType=" & rsOld("ChannelID") & "")
            
            rsNew("DefaultSkinID") = GetNewID(ArrSkinID, rsOld("DefaultSkinID"))
            rsNew("Template_Index") = GetNewID(ArrTemplateID, rsOld("Template_Index"))
            rsNew("Meta_Keywords") = ""
            rsNew("Meta_Description") = ""
            rsNew("ShowNameOnPath") = rsOld("ShowName")
            If rsOld("EnableCheck") = True Then
                rsNew("CheckLevel") = 1
            Else
                rsNew("CheckLevel") = 0
            End If
            rsNew("UpdatePages") = 3
            rsNew("ChannelPurview") = 0
            rsNew("arrGroupID") = ""
            rsNew("JS_SpecialNum") = 10
            rsNew("AuthorInfoLen") = 8
            rsNew("MaxPerPage_Index") = 20
            rsNew("MaxPerPage_SearchResult") = 10
            rsNew("MaxPerPage_New") = 20
            rsNew("MaxPerPage_Hot") = 20
            rsNew("MaxPerPage_Elite") = 20
            rsNew("MaxPerPage_SpecialList") = 20
            rsNew("MoneyPerKw") = 100
            rsNew("arrEnabledTabs") = "Charge,Vote,Recieve,Copyfee,SoftParameter"
            rsNew("TimingCreateSetting") = ""
            rsNew("EmailOfReject") = ""
            rsNew("EmailOfPassed") = ""
            'rsNew("CommandChannelPoint") = 0
        Case "PE_Article"
            rsNew("Author") = ChangeAuthor(rsOld("Author"))
            rsNew("CopyFrom") = ChangeAuthor(rsOld("CopyFrom"))
            rsNew("SkinID") = GetNewID(ArrSkinID, rsOld("SkinID"))
            rsNew("TemplateID") = GetNewID(ArrTemplateID, rsOld("TemplateID"))
            '注意这里的ChannelID=1，这是因为前面已经将ChannelID变成了ModuleType
            rsNew("CommentCount") = PE_CLng(Conn_Old.Execute("select count(*) from PE_Comment where ChannelID=1 and InfoID=" & rsOld("ArticleID") & "")(0))
            rsNew("CreateTime") = PE_CDate(rsOld("UpdateTime"))
            rsNew("Status") = GetStatusByPassed(rsOld("Passed"))
            rsNew("InfoPoint") = rsOld("ReadPoint")
            'rsNew("PayDate") =
            rsNew("VoteID") = 0
            rsNew("InfoPurview") = 0
            rsNew("arrGroupID") = ""
            rsNew("ChargeType") = 0
            rsNew("PitchTime") = 0
            rsNew("ReadTimes") = 0
            rsNew("DividePercent") = 0
            rsNew("BlogID") = 0
            Conn.Execute ("insert into PE_InfoS (ModuleType,ItemID,SpecialID) values (1," & rsOld("ArticleID") & "," & rsOld("SpecialID") & ")")
        Case "PE_Photo"
            rsNew("Author") = ChangeAuthor(rsOld("Author"))
            rsNew("CopyFrom") = ChangeAuthor(rsOld("CopyFrom"))
            rsNew("SkinID") = GetNewID(ArrSkinID, rsOld("SkinID"))
            rsNew("TemplateID") = GetNewID(ArrTemplateID, rsOld("TemplateID"))
            '注意这里的ChannelID=3，这是因为前面已经将ChannelID变成了ModuleType
            rsNew("CommentCount") = PE_CLng(Conn_Old.Execute("select count(*) from PE_Comment where ChannelID=3 and InfoID=" & rsOld("PhotoID") & "")(0))
            rsNew("CreateTime") = rsOld("UpdateTime")
            rsNew("Status") = GetStatusByPassed(rsOld("Passed"))
            rsNew("InfoPoint") = rsOld("PhotoPoint")
            'rsNew("PayDate") =
            rsNew("VoteID") = 0
            rsNew("InfoPurview") = 0
            rsNew("arrGroupID") = ""
            rsNew("ChargeType") = 0
            rsNew("PitchTime") = 0
            rsNew("ReadTimes") = 0
            rsNew("DividePercent") = 0
            rsNew("BlogID") = 0
            Conn.Execute ("insert into PE_InfoS (ModuleType,ItemID,SpecialID) values (3," & rsOld("PhotoID") & "," & rsOld("SpecialID") & ")")
        Case "PE_Soft"
            rsNew("Author") = ChangeAuthor(rsOld("Author"))
            rsNew("CopyFrom") = ChangeAuthor(rsOld("CopyFrom"))
            rsNew("SkinID") = GetNewID(ArrSkinID, rsOld("SkinID"))
            rsNew("TemplateID") = GetNewID(ArrTemplateID, rsOld("TemplateID"))
            '注意这里的ChannelID=2，这是因为前面已经将ChannelID变成了ModuleType
            rsNew("CommentCount") = PE_CLng(Conn_Old.Execute("select count(*) from PE_Comment where ChannelID=2 and InfoID=" & rsOld("SoftID") & "")(0))
            rsNew("CreateTime") = rsOld("UpdateTime")
            rsNew("Status") = GetStatusByPassed(rsOld("Passed"))
            rsNew("InfoPoint") = rsOld("SoftPoint")
            rsNew("BrowseTimes") = rsOld("Hits")
            rsNew("VoteID") = 0
            rsNew("InfoPurview") = 0
            rsNew("arrGroupID") = ""
            rsNew("ChargeType") = 0
            rsNew("PitchTime") = 0
            rsNew("ReadTimes") = 0
            rsNew("DividePercent") = 0
            rsNew("BlogID") = 0
            Conn.Execute ("insert into PE_InfoS (ModuleType,ItemID,SpecialID) values (2," & rsOld("SoftID") & "," & rsOld("SpecialID") & ")")
        Case "PE_JsFile"
            rsNew("ContentType") = 0
        Case "PE_FriendSite"
            rsNew("OrderID") = rsOld("ID")
        End Select

        rsNew.Update
        rsOld.movenext
        RecordIndex = RecordIndex + 1
        If (RecordIndex Mod 10) = 0 Then
            Call RefreshPercentBar(True)
        End If
        TotalRecordIndex = TotalRecordIndex + 1
        If Response.IsClientConnected = False Then Exit Do
    Loop
    rsOld.Close
    rsNew.Close
    Call RefreshPercentBar(False)
End Sub

Function CheckExistField(ByVal FieldName, ByVal ChannelID)
    Dim strSql
    strSql = "Select Count(*) From PE_Field Where ChannelID=" & ChannelID & " And FieldName ='" & FieldName & "'"
    If PE_CLng(Conn_Old.Execute(strSql)(0)) > 0 Then
        CheckExistField = True
    Else
        CheckExistField = False
    End If
End Function

Function CheckAdminExistField(ByVal FieldName)
    Dim strSql
    If FieldName = "AdminPurview_Others" Then
        CheckAdminExistField = True
        Exit Function
    End If
    FieldName = Right(FieldName, Len(FieldName) - Len("AdminPurview_"))
    strSql = "Select Count(*) From PE_Channel Where ChannelDir='" & FieldName & "'"
    If PE_CLng(Conn_Old.Execute(strSql)(0)) > 0 Then
        CheckAdminExistField = True
    Else
        CheckAdminExistField = False
    End If
End Function

Sub Update_PE_User()
    On Error Resume Next
    Info_CurrentUpdate = "正在升级注册会员数据"
    TableName = "PE_User"
    RecordNum = GetRecordNum(TableName)
    RecordIndex = 0
    Call RefreshPercentBar(True)
    Conn.Execute ("delete from PE_User")
    Conn.Execute ("delete from PE_Contacter")
    Conn.Execute ("delete from PE_Client")
    Conn.Execute ("delete from PE_Company")
    Dim rsUser2, rsUser, rsContacter, rsClient
    Dim ContacterID, tmpContacterID, ClientID, tmpClientID, tmpClientName
    ContacterID = 0
    ClientID = 0
    Set rsUser2 = Server.CreateObject("ADODB.Recordset")
    Set rsUser = Server.CreateObject("ADODB.Recordset")
    Set rsContacter = Server.CreateObject("ADODB.Recordset")
    Set rsClient = Server.CreateObject("ADODB.Recordset")
    rsUser2.open "select * from PE_User Order by UserID Asc", Conn_Old, 1, 1
    rsUser.open "select * from PE_User", Conn, 1, 3
    rsContacter.open "select * from PE_Contacter", Conn, 1, 3
    rsClient.open "select * from PE_Client", Conn, 1, 3
    Do While Not rsUser2.EOF
        If PE_CLng(Conn_Old.Execute("select count(*) from PE_OrderForm where UserID=" & rsUser2("UserID") & "")(0)) > 0 Then
            ClientID = ClientID + 1
            tmpClientID = ClientID
            rsClient.addnew
            rsClient("ClientID") = ClientID
            rsClient("CreateTime") = Now()
            rsClient("Owner") = ""
            If rsUser2("TrueName") <> "" Then
                tmpClientName = rsUser2("TrueName")
            Else
                If rsUser2("Company") <> "" Then
                    tmpClientName = rsUser2("Company")
                Else
                    tmpClientName = rsUser2("UserName")
                End If
            End If
            rsClient("ClientName") = tmpClientName
            rsClient("ClientNum") = rsUser2("ClientNum")
            rsClient("ShortedForm") = Left(tmpClientName, 6)
            rsClient("ClientType") = 1
            rsClient("Area") = -1
            rsClient("ClientField") = -1
            rsClient("ValueLevel") = -1
            rsClient("CreditLevel") = -1
            rsClient("Importance") = -1
            rsClient("ConnectionLevel") = -1
            rsClient("SourceType") = -1
            rsClient("GroupID") = 0
            rsClient("ParentID") = 0
            rsClient("PhaseType") = -1
            rsClient("Remark") = ""
            rsClient("UpdateTime") = Now()
            rsClient.Update
            Conn.Execute ("update PE_OrderForm set ClientID='" & ClientID & "' where UserName='PE$$$" & rsUser2("UserID") & "'")
            Conn.Execute ("update PE_BankrollItem set ClientID='" & ClientID & "' where UserName='PE$$$" & rsUser2("UserID") & "'")
        Else
            tmpClientID = 0
        End If
        'If rsUser2("TrueName") <> "" Then
        ContacterID = ContacterID + 1
        tmpContacterID = ContacterID
        rsContacter.addnew
        rsContacter("ContacterID") = ContacterID
        rsContacter("ClientID") = tmpClientID
        rsContacter("ParentID") = 0
        rsContacter("TrueName") = rsUser2("TrueName")
                    
        rsContacter("Department") = rsUser2("Department")
        rsContacter("Position") = rsUser2("PosTitle")
        rsContacter("Operation") = ""
        rsContacter("UserType") = 0

        rsContacter("Country") = rsUser2("Country")
        rsContacter("Province") = rsUser2("Province")
        rsContacter("City") = rsUser2("City")
        rsContacter("ZipCode") = rsUser2("ZipCode")
        rsContacter("Address") = rsUser2("Address")

        rsContacter("Mobile") = rsUser2("Mobile")
        rsContacter("OfficePhone") = Left(rsUser2("OfficePhone"), 30)
        rsContacter("HomePhone") = Left(rsUser2("HomePhone"), 30)
        rsContacter("PHS") = ""
        rsContacter("Fax") = rsUser2("Fax")

        rsContacter("Homepage") = rsUser2("Homepage")
        rsContacter("Email") = rsUser2("Email")
        rsContacter("QQ") = rsUser2("QQ")
        rsContacter("MSN") = rsUser2("MSN")
        rsContacter("ICQ") = rsUser2("ICQ")
        rsContacter("Yahoo") = rsUser2("Yahoo")
        rsContacter("UC") = rsUser2("UC")
        rsContacter("Aim") = rsUser2("Aim")

        rsContacter("BirthDay") = PE_CDate(rsUser2("BirthDay"))
        rsContacter("IDCard") = rsUser2("IDCard")
        'rsContacter("NativePlace") = rsUser2("NativePlace")
        'rsContacter("Nation") = rsUser2("Nation")
        rsContacter("Sex") = rsUser2("Sex")
        rsContacter("Marriage") = rsUser2("Marriage")
        rsContacter("Education") = -1
        rsContacter("GraduateFrom") = ""
        rsContacter("InterestsOfLife") = ""
        rsContacter("InterestsOfCulture") = ""
        rsContacter("InterestsOfAmusement") = ""
        rsContacter("InterestsOfSport") = ""
        rsContacter("InterestsOfOther") = ""
        rsContacter("Income") = -1
        rsContacter("Family") = ""

        rsContacter("UpdateTime") = Now()
        rsContacter("Company") = rsUser2("Company")
        rsContacter("CompanyAddress") = rsUser2("Address")
        rsContacter.Update
        'Else
            'tmpContacterID = 0
        'End If

        rsUser.addnew
        rsUser("UserID") = rsUser2("UserID")
        rsUser("ClientID") = tmpClientID
        rsUser("ContacterID") = tmpContacterID
        rsUser("GroupID") = rsUser2("GroupID")
        rsUser("UserName") = rsUser2("UserName") & ""
        rsUser("UserPassword") = rsUser2("UserPassword") & ""
        rsUser("LastPassword") = rsUser2("LastPassword") & ""
        rsUser("Question") = rsUser2("Question") & ""
        rsUser("Answer") = rsUser2("Answer") & ""
        rsUser("Email") = rsUser2("Email") & ""
        rsUser("UserFace") = rsUser2("UserFace") & ""
        rsUser("FaceWidth") = PE_CLng(rsUser2("FaceWidth"))
        rsUser("FaceHeight") = PE_CLng(rsUser2("FaceHeight"))
        rsUser("Sign") = rsUser2("Sign") & ""
        rsUser("RegTime") = PE_CDate(rsUser2("RegTime"))
        rsUser("JoinTime") = PE_CDate(rsUser2("JoinTime"))
        rsUser("LastLoginTime") = PE_CDate(rsUser2("LastLoginTime"))
        rsUser("LastPresentTime") = Now()
        rsUser("LastLoginIP") = rsUser2("LastLoginIP") & ""
        rsUser("LoginTimes") = rsUser2("LoginTimes")
        rsUser("Balance") = rsUser2("Balance")
        rsUser("UserPoint") = rsUser2("UserPoint")
        rsUser("UserExp") = rsUser2("UserExp")
        rsUser("PostItems") = rsUser2("PostItems")
        rsUser("PassedItems") = rsUser2("PassedItems")
        rsUser("DelItems") = rsUser2("DelItems")
        rsUser("UnsignedItems") = rsUser2("UnsignedItems")
        rsUser("UnreadMsg") = rsUser2("UnreadMsg")
        rsUser("BeginTime") = rsUser2("BeginTime")
        rsUser("UserFriendGroup") = "黑名单$我的好友"
        rsUser("ValidNum") = rsUser2("ValidNum")
        rsUser("ValidUnit") = rsUser2("ValidUnit")
        rsUser("IsLocked") = rsUser2("IsLocked")
        rsUser("SpecialPermission") = PE_CBool(rsUser2("SpecialPermission"))
        rsUser("arrClass_Browse") = rsUser2("arrClass_Browse")
        rsUser("arrClass_View") = rsUser2("arrClass_View")
        rsUser("arrClass_Input") = rsUser2("arrClass_Input")
        rsUser("Privacy") = rsUser2("Privacy")
        rsUser("UserSetting") = rsUser2("UserSetting")
        rsUser("CheckNum") = rsUser2("CheckNum")
        'rsUser("Blog") = False
        rsUser.Update

        '将原来升级过来的UserID变成UserName
        Conn.Execute ("update PE_BankrollItem set UserName='" & rsUser2("UserName") & "' where UserName='PE$$$" & rsUser2("UserID") & "'")
        Conn.Execute ("update PE_OrderForm set UserName='" & rsUser2("UserName") & "' where UserName='PE$$$" & rsUser2("UserID") & "'")
        Conn.Execute ("update PE_Payment set UserName='" & rsUser2("UserName") & "' where UserName='PE$$$" & rsUser2("UserID") & "'")

        rsUser2.movenext

        TotalRecordIndex = TotalRecordIndex + 1
        RecordIndex = RecordIndex + 1
        If (RecordIndex Mod 10) = 0 Then
            Call RefreshPercentBar(True)
        End If
    Loop
    rsUser2.Close
    Set rsUser2 = Nothing
    rsUser.Close
    Set rsUser = Nothing
    rsContacter.Close
    Set rsContacter = Nothing
    rsClient.Close
    Set rsClient = Nothing
    Call RefreshPercentBar(False)
End Sub

Sub Update_66()
    If SystemDatabaseType = "SQL" Then
        If IsExists("fieldlist", "PE_Label") = True Then
           CONN.execute ("alter table [PE_Label]  alter column  fieldlist  [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL")
        End If
        If IsExists("arrChannelID", "PE_Contacter") = False Then
            CONN.execute ("alter table [PE_Contacter]  add  arrChannelID [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL")
        End If
        If IsExists("ChannelID", "PE_MailChannel") = False Then
            CONN.execute ("create table [PE_MailChannel]( [ChannelID] integer NOT NULL  PRIMARY KEY,[UserID] nvarchar(255),[arrClass] nvarchar(255),[SendNum] integer,[IsUse] bit)")
        End If
    Else
        If IsExists("fieldlist", "PE_Label") = True Then
           CONN.execute ("alter table [PE_Label]  alter  fieldlist  text(255)")
        End If
        If IsExists("arrChannelID", "PE_Contacter") = False Then
            CONN.execute ("alter table [PE_Contacter]  add  COLUMN arrChannelID  text(255)")
        End If
        If IsExists("ChannelID", "PE_MailChannel") = False Then
            CONN.execute ("create table [PE_MailChannel]( [ChannelID] integer not null  PRIMARY KEY,[UserID] text(255) null,[arrClass] text(255),[SendNum] integer, [IsUse] bit )")
        End If
    End If
    Dim rsChannel ,sqlMail ,rsMail,rsCheck
    Set rsChannel = Conn_Old.execute("select * from PE_Channel where ModuleType = 1")
    sqlMail = "select * from PE_MailChannel"
    Set rsMail = Server.CreateObject("adodb.recordset")
    rsMail.open sqlMail, CONN, 1, 3
    Do While Not rsChannel.EOF
        Set rsCheck = CONN.execute("select * from PE_MailChannel where ChannelID = " & rsChannel("ChannelID"))
        If rsCheck.BOF And rsCheck.EOF Then
            rsMail.addnew
            rsMail("ChannelID") = rsChannel("ChannelID")
            rsMail("UserID") = ""
            rsMail("SendNum") = 10
            rsMail("arrClass") = ""
            rsMail("IsUse") = PE_False
            rsMail.Update
        End If
        rsChannel.movenext
    Loop
    rsMail.Close
    Set rsMail = Nothing
    rsChannel.Close
    Set rsChannel = Nothing
End Sub


Sub RefreshPercentBar(IsFirstRecord)
    Response.Write "<script>" & vbCrLf
    If RecordIndex = 0 And IsFirstRecord = True Then
        Response.Write "Info_CurrentUpdate.innerHTML=""" & Info_CurrentUpdate & "..."";" & vbCrLf
        Response.Write "myform.UpdateInfo.value+=""" & Info_CurrentUpdate & "................."";" & vbCrLf
        Response.Write "myform.UpdateInfo.scrollTop=myform.UpdateInfo.scrollHeight;" & vbCrLf
    End If
    If RecordNum > 0 Then
        Response.Write "PercentBar.width="
        If Fix((RecordIndex / RecordNum) * 630) = 0 Then
            Response.Write "1;" & vbCrLf
        Else
            Response.Write Fix((RecordIndex / RecordNum) * 630) & ";" & vbCrLf
        End If
        Response.Write "Info_CurrentPercent.innerHTML=""" & FormatNumber(RecordIndex / RecordNum * 100, 2, -1) & """;" & vbCrLf
        Response.Write "Info_CurrentRecord.innerHTML=""" & RecordIndex & "/" & RecordNum & """;" & vbCrLf
        
    End If
    If RecordIndex >= RecordNum And IsFirstRecord = False Then
        Response.Write "myform.UpdateInfo.value+='成功！\n';" & vbCrLf
    End If
    If TotalRecordNum > 0 Then
        Response.Write "TotalPercentBar.width="
        If Fix((TotalRecordIndex / TotalRecordNum) * 630) = 0 Then
            Response.Write "1;" & vbCrLf
        Else
            Response.Write Fix((TotalRecordIndex / TotalRecordNum) * 630) & ";" & vbCrLf
        End If
        Response.Write "Info_TotalPercent.innerHTML=""" & FormatNumber(TotalRecordIndex / TotalRecordNum * 100, 2, -1) & """;" & vbCrLf
        Response.Write "Info_TotalRecord.innerHTML=""" & TotalRecordIndex & "/" & TotalRecordNum & """;" & vbCrLf
    End If
    Response.Write "</script>" & vbCrLf
    Response.Flush
End Sub

Sub InitPercentBar()
End Sub


Function GetRecordNum(strTable)
    If strTable = "" Then
        GetRecordNum = 0
        Exit Function
    End If
    Dim nrs
    Set nrs = Conn_Old.Execute("select Count(*) from " & strTable)
    GetRecordNum = nrs(0)
    If IsNull(GetRecordNum) Then GetRecordNum = 0
    nrs.Close
    Set nrs = Nothing
End Function

Sub ErrorHandle(ErrTable, ErrRecord, EndUpdate)
    If Err.Number <> 0 Then
        Select Case Err.Number
        Case -2147217887
            If EndUpdate = 1 Then
                Response.Write "出错表：" & ErrTable & " 出错记录：" & ErrRecord & " 升级失败，因为有相同ID的记录存在。请检查后重新升级！<br>"
            Else
                Response.Write "出错表：" & ErrTable & " 出错记录：" & ErrRecord & " 此记录未升级成功，因为有相同ID的记录存在。<br>"
            End If
        Case Else
            If IsObject(Conn) Then
                If Conn.Errors.Count > 0 Then
                    For i = 0 To Conn.Errors.Count - 1
                        Response.Write "错误类型：数据库错误<BR>"
                        Response.Write "错 误 号：" & Conn.Errors(i).Number & "<BR>"
                        Response.Write "错误描述：" & Conn.Errors(i).Description & "<BR>"
                        Response.Write "错误来源：" & Conn.Errors(i).Source & "<BR>"
                        'Response.Write "SQLState: " & conn.Errors(i).SQLState & "<BR>"
                        'Response.Write "NativeError: " & conn.Errors(i).NativeError & "<BR>"
                    Next
                End If
            Else
                If Err.Number <> 0 Then
                    Response.Write "错误类型：页面错误<BR>"
                    Response.Write "错 误 号：" & Err.Number & "<BR>"
                    Response.Write "错误描述：" & Err.Description & "<BR>"
                    Response.Write "错误来源：" & Err.Source & "<BR>"
                    'Response.Write "出 错 行：" & Err.Line & "<BR>"
                End If
            End If
        End Select
        Err.Clear
        If EndUpdate = 1 Then
            Response.End
        End If
    End If
End Sub

Function GetStatusByPassed(iPassed)
    If iPassed = True Then
        GetStatusByPassed = 3
    Else
        GetStatusByPassed = 0
    End If
End Function

Sub DelAllCache()
    Dim Cacheobj, strAllCache, CacheList, i
    For Each Cacheobj In Application.Contents
        strAllCache = strAllCache & Cacheobj & ","
    Next
    CacheList = Split(strAllCache, ",")
    If UBound(CacheList) > 0 Then
        For i = 0 To UBound(CacheList)
            Application.Lock
            Application.Contents.Remove CacheList(i)
            Application.UnLock
        Next
    End If
End Sub

Function FoundInArr(strArr, strItem)
    Dim arrTemp, i
    FoundInArr = False
    arrTemp = Split(strArr, ",")
    For i = 0 To UBound(arrTemp)
        If LCase(Trim(arrTemp(i))) = LCase(Trim(strItem)) Then
            FoundInArr = True
            Exit For
        End If
    Next
End Function

Function GetNewID(ArrID, OldID)
    Dim i
    If OldID = 0 Or IsNull(OldID) Then
        GetNewID = 0
        Exit Function
    End If
    GetNewID = OldID
    For i = 0 To UBound(ArrID)
        If ArrID(i, 0) = PE_CLng(OldID) Then
            GetNewID = ArrID(i, 1)
            Exit Function
        End If
    Next
End Function

Function PE_CLng(ByVal str1)
    If IsNumeric(str1) Then
        PE_CLng = CLng(str1)
    Else
        PE_CLng = 0
    End If
End Function

Function PE_CDate(ByVal str1)
    If IsDate(str1) Then
        PE_CDate = CDate(str1)
    Else
        PE_CDate = Now
    End If
End Function

Function PE_CBool(ByVal bool1)
    If Not IsNull(bool1) Then
        PE_CBool = CBool(bool1)
    Else
        PE_CBool = False
    End If
End Function

Function ChangeAuthor(ByVal str1)
    If Not IsNull(str1) Then
        If Right(str1, 1) = "|" Then
            ChangeAuthor = Left(str1, Len(str1) - 1)
        Else
            ChangeAuthor = str1
        End If
    End If
End Function


Function AppendSkinCss()
    Dim strCss
    strCss = vbCrLf
    strCss = strCss & "/* --用户控制css定义开始-- */" & vbCrLf
    strCss = strCss & ".user_left /*左区块定义*/" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "background:#f3f3f3;width:170px;padding-left: 4px;border-left-width: 2px;border-left-style: solid;border-left-color: #ffffff;padding-right: 4px;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".user_box/*左区块内标题栏定义*/" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "border: 1px solid #bfbfbf;background-color: #ffffff;border-collapse:15;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".user_righttitle {" & vbCrLf
    strCss = strCss & "background-color: #f3f3f3;padding-top: 5px;padding-right: 5px;padding-bottom: 1px;padding-left: 5px;" & vbCrLf
    strCss = strCss & "border-top-width: 2px;border-right-width: 2px;border-bottom-width: 1px;border-left-width: 2px;" & vbCrLf
    strCss = strCss & "border-top-style: solid;border-right-style: solid;border-bottom-style: solid;border-left-style: solid;" & vbCrLf
    strCss = strCss & "border-top-color: #ffffff;border-right-color: #ffffff;border-bottom-color: #bfbfbf;border-left-color: #ffffff;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".user_line {" & vbCrLf
    strCss = strCss & "line-height: 1px;background-image: url(images/line.gif);" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".user_toolstop/*左区块内标题栏定义*/" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "line-height: 28px;font-size: 12px;font-weight: bold;color: #666666;padding-left: 10px;letter-spacing: 4pt;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".user_toolsbot/*左区块内内容定义*/" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "line-height: 25px;font-size: 12px;color: #666666;border-right-width: 4px;border-right-style: solid;border-right-color: #ffffff;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".user_toolspoint/*区块内箭头栏定义*/" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "padding-left: 6px;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "/*用户控制面板右*/" & vbCrLf
    strCss = strCss & ".user_right {" & vbCrLf
    strCss = strCss & "background-color: #ffffff;padding-right: 2px;padding-left: 6px;width:572px;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".border1" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "border: 1px solid #bfbfbf;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".title" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "background:#449ae8;color: #ffffff;font-weight: normal;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".border" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "border: 1px solid #449ae8;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".tdbg" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "background:#f0f0f0;line-height: 120%;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".tdbgmouseover{" & vbCrLf
    strCss = strCss & "background:#bfdfff;line-height: 120%;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".tdbg2" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "background:#e0eef5;line-height: 120%;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".tdbg5" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "background:#e0eef5;line-height: 120%;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".title5" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "width:80px;background:url('../user/images/titlebg2.gif');line-height: 120%;padding-top:2px;cursor:hand;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".title6" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "width:80px;background:url('../user/images/titlebg1.gif');color: #ffffff;font-weight: normal;padding-top:2px;cursor:hand;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".button1" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "width:90px;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".show_page {" & vbCrLf
    strCss = strCss & "text-align: center;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "/* 固定排课表格表格的css定义*/" & vbCrLf
    strCss = strCss & ".date_border" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "border: 1px solid ;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".date_title" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "background:#449ae8;color: #ffffff;font-weight: normal;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".date_tdbg" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "background:#449ae8;color: #ffffff;font-weight: normal;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".style2" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "font-size: 10px;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".style3" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "font-size: 12px;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "/* ==RSS连接框定义== */" & vbCrLf
    strCss = strCss & "#popitmenu {" & vbCrLf
    strCss = strCss & "    BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; Z-INDEX: 100; VISIBILITY: hidden; FONT: 12px/18px Verdana; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid; POSITION: absolute; BACKGROUND-COLOR: white" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "#popitmenu A {" & vbCrLf
    strCss = strCss & "    DISPLAY: block; PADDING-LEFT: 6px; COLOR: black; TEXT-DECORATION: none;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "#popitmenu A:hover {" & vbCrLf
    strCss = strCss & "    BACKGROUND-COLOR: #ccff9d;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "" & vbCrLf
    strCss = strCss & "/* ==用户登录框定义== */" & vbCrLf
    strCss = strCss & "#userlogined" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "    padding-left:10;text-align: left;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "#userctrl" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "    text-align: center;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "#usermessage" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "    padding-left:10;text-align: left;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".havemessage" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "    BACKGROUND-COLOR: #ccff9d;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".havemessaged" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "    BACKGROUND-COLOR: #cc0000;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".spaceList  /* 聚合空间列表定义 */" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "width: 100%;text-align: center;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".spaceList_image" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "text-align: center;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".spaceList_intro" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "text-align: center;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "#showspacelist_more" & vbCrLf
    strCss = strCss & "{" & vbCrLf
    strCss = strCss & "text-align: right;padding-right:10;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "/* ==供求信息div按钮定义开始== */" & vbCrLf
    strCss = strCss & "#supply{" & vbCrLf
    strCss = strCss & "margin:0px;" & vbCrLf
    strCss = strCss & "padding:0px;" & vbCrLf
    strCss = strCss & "color:#fff;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".supplybut,.supplybutover{" & vbCrLf
    strCss = strCss & "margin:0px;" & vbCrLf
    strCss = strCss & "padding:1px;" & vbCrLf
    strCss = strCss & "line-height:25px;" & vbCrLf
    strCss = strCss & "border-top: 1px solid #d2d3d9;border-right: 1px solid #d2d3d9;border-left: 1px solid #d2d3d9;text-align: left;padding-left:30;padding-right:15px;" & vbCrLf
    strCss = strCss & "display: block;" & vbCrLf
    strCss = strCss & "float:left;" & vbCrLf
    strCss = strCss & "margin-right:8px;" & vbCrLf
    strCss = strCss & "cursor:hand;" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".supplybut{" & vbCrLf
    strCss = strCss & "background:url(skin/blue/main_title_575.gif);" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & ".supplybutover{" & vbCrLf
    strCss = strCss & "background:url(skin/blue/main_title_282.gif);" & vbCrLf
    strCss = strCss & "}" & vbCrLf
    strCss = strCss & "/* ==供求信息div按钮定义开始== */" & vbCrLf
    AppendSkinCss = strCss
End Function
Function IsExists(fieldName, tableName)
    On Error Resume Next
    IsExists = True
    CONN.execute ("select " & fieldName & " from " & tableName)

    If Err Then
        IsExists = False
    End If
    Err.Clear
End Function
%>