📄 updateaddthreestep.asp
字号:
<% Option Explicit %>
<!--#include file="inc/Cls_DB.asp" -->
<!--#include file="Inc/Const.asp" -->
<!--#include file="inc/PublicFun.asp" -->
<%
Dim DBC,UpdateConn,Conn
Set DBC = New DataBaseClass
DBC.ConnStr = "DBQ=" + server.mappath("SunData/Update.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set UpdateConn = DBC.OpenConnection()
DBC.ConnStr = "DBQ=" + Server.MapPath(DataBaseConnectStr) + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
'判断权限
%>
<%
'判断权限结束
Dim Submit,MainID,i
Submit = Request("Submit")
MainID = Request("MainID")
if MainID = "" then
Set UpdateConn = Nothing
Response.Write("<script>alert('参数传递出错');window.location.href='UpDateManage.asp'</script>")
Response.End
end if
Dim SourceDBType,SServer,SourceDB,SUser,SPassWord,ObjectDBType,OServer,ObjectDB,OUser,OPassWord
if Submit = "Add" then
Dim DataBaseType,RsDBSOObj
Set RsDBSOObj = Server.CreateObject("ADODB.RecordSet")
RsDBSOObj.Open "Select * from DBSO where MainID='" & MainID & "'",UpdateConn,3,3
if RsDBSOObj.Eof then RsDBSOObj.AddNew
DataBaseType = Request("DataBaseType")
if DataBaseType = "1" then
OServer = Request("SqlServer")
ObjectDB = Request("SqlDataBase")
OUser = Request("SqlUser")
OPassWord = Request("SqlPassWord")
elseif DataBaseType = "2" then
OServer = Request("AccessServer")
ObjectDB = Request("AccessDB")
OUser = Request("AccessUser")
OPassWord = Request("AccessPassWord")
end if
'On Error Resume Next
RsDBSOObj("OServer") = OServer
RsDBSOObj("ObjectDBType") = DataBaseType
RsDBSOObj("ObjectDB") = ObjectDB
RsDBSOObj("OUser") = OUser
RsDBSOObj("OPassWord") = OPassWord
RsDBSOObj.UpDate
Set RsDBSOObj = Nothing
if Err.Number <> 0 then
Response.Write("<script>alert('数据出错');window.location.href='UpdateAddTwoStep.asp?MainID=" & MainID & "';</script>")
Response.End
end if
end if
Dim RSUpdateObj
Set RSUpdateObj = UpdateConn.Execute("Select * from DBSO where MainID='" & MainID & "'")
if RSUpdateObj.Eof then
Response.Write("<script>alert('数据出错');window.location.href='UpdateAddTwoStep.asp?MainID=" & MainID & "';</script>")
Response.End
else
Dim SourceDBTableArray,ObjectDBTableArray,TableCorrTextArray,TableCorrValueArray
SourceDBType = RSUpdateObj("SourceDBType")
SServer = RSUpdateObj("SServer")
SourceDB = RSUpdateObj("SourceDB")
SUser = RSUpdateObj("SUser")
SPassWord = RSUpdateObj("SPassWord")
SourceDBTableArray = ListDBAllTable(SourceDBType,SServer,SourceDB,SUser,SPassWord)
if UBound(SourceDBTableArray) <= 0 then
Set UpdateConn = Nothing
Set RSUpdateObj = Nothing
Response.Write("<script>alert('源数据库链接错误');window.location.href='UpdateAddOneStep.asp?MainID=" & MainID & "';</script>")
Response.End
end if
ObjectDBType = RSUpdateObj("ObjectDBType")
OServer = RSUpdateObj("OServer")
ObjectDB = RSUpdateObj("ObjectDB")
OUser = RSUpdateObj("OUser")
OPassWord = RSUpdateObj("OPassWord")
ObjectDBTableArray = ListDBAllTable(ObjectDBType,OServer,ObjectDB,OUser,OPassWord)
if UBound(ObjectDBTableArray) <= 0 then
Set UpdateConn = Nothing
Set RSUpdateObj = Nothing
Response.Write("<script>alert('目标数据库链接错误');window.location.href='UpdateAddTwoStep.asp?MainID=" & MainID & "';</script>")
Response.End
end if
Dim RSTableCorrObj,TableCorrTextStr,TableCorrValueStr
TableCorrTextStr = ""
TableCorrValueStr = ""
Set RSTableCorrObj = UpdateConn.Execute("Select * from TableSO where DBSOID='" & MainID & "'")
do while Not RSTableCorrObj.Eof
if TableCorrTextStr = "" then
TableCorrTextStr = RSTableCorrObj("STable") & "---" & RSTableCorrObj("OTable")
else
TableCorrTextStr = TableCorrTextStr & "$$$" & RSTableCorrObj("STable") & "---" & RSTableCorrObj("OTable")
end if
if TableCorrValueStr = "" then
TableCorrValueStr = RSTableCorrObj("ID") & "---" & RSTableCorrObj("STable") & "---" & RSTableCorrObj("OTable")
else
TableCorrValueStr = TableCorrValueStr & "$$$" & RSTableCorrObj("ID") & "---" & RSTableCorrObj("STable") & "---" & RSTableCorrObj("OTable")
end if
RSTableCorrObj.MoveNext
Loop
Set RSTableCorrObj = Nothing
if (TableCorrTextStr = "") OR (TableCorrValueStr = "") then
TableCorrTextArray = Array()
TableCorrValueArray = Array()
else
TableCorrTextArray = Split(TableCorrTextStr,"$$$")
TableCorrValueArray = Split(TableCorrValueStr,"$$$")
end if
end if
Set RSUpdateObj = Nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>添加数据库转换规则</title>
</head>
<link href="inc/Collect.css" rel="stylesheet">
<body topmargin="0" leftmargin="0">
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="UpdateForm" method="get" action="UpdateAddFourStep.asp">
<tr bgcolor="#E4E4E4">
<td height="30" background="images/Collect_bg.gif"><font color="#FF0000"><strong>数据转移规则---第四步---数据库表的对应</strong></font></td>
</tr>
<tr>
<td bgcolor="#F3F3F3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">源数据库表</div></td>
<td><div align="center">目标数据库表</div></td>
</tr>
<tr>
<td width="50%"> <div align="left">
<select style="width:100%;" name="SourceTableList" size="6">
<%
for i = LBound(SourceDBTableArray) to UBound(SourceDBTableArray)
%>
<option value="<% = SourceDBTableArray(i) %>">
<% = SourceDBTableArray(i) %>
</option>
<%
Next
%>
</select>
</div></td>
<td> <div align="left">
<select name="ObjectTableList" style="width:100%;" size="6">
<%
for i = LBound(ObjectDBTableArray) to UBound(ObjectDBTableArray)
%>
<option value="<% = ObjectDBTableArray(i) %>">
<% = ObjectDBTableArray(i) %>
</option>
<%
Next
%>
</select>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#F3F3F3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
<input type="button" name="Submit2" onClick="AddTableCorr();" value=" 添 加 ">
</div></td>
<td><div align="center">
<input type="button" onClick="DelTableCorr();" name="Submit3" value=" 删 除 ">
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#F3F3F3"><div align="center">
<select name="TableCorrList" size="6" multiple style="width:100%;">
<%
for i = LBound(TableCorrTextArray) to UBound(TableCorrTextArray)
%>
<option value="<% = TableCorrValueArray(i) %>"><% = TableCorrTextArray(i) %></option>
<%
Next
%>
</select>
</div></td>
</tr>
<tr>
<td bgcolor="#F3F3F3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
<input name="Submitttt" onClick="window.location.href='UpDateAddTwoStep.asp?MainID=<% = MainID %>';" type="button" id="Submitttt" value="上 一 步">
<input type="hidden" name="MainID" value="<% = MainID %>">
<input type="hidden" name="Submit" value="Add">
<input type="hidden" name="TableCorrInfo">
</div></td>
<td><div align="center">
<input name="Submit2dfsd" onClick="SubmitData();" type="button" id="Submit2dfsd" value="下 一 步">
</div></td>
</tr>
</table></td>
</tr>
</form>
</table>
</body>
</html>
<%
Set UpdateConn = Nothing
%>
<script language="JavaScript">
function AddTableCorr()
{
var ErrorStr='',i=0,AddOption=null;
var TableCorrListObj=document.UpdateForm.TableCorrList;
var SourceTableListObj=document.UpdateForm.SourceTableList;
var ObjectTableListObj=document.UpdateForm.ObjectTableList;
var SelectedSourceTable=SourceTableListObj.value;
var SelectedObjectTable=ObjectTableListObj.value;
if (SelectedSourceTable=='') {ErrorStr='请选择源数据库表';alert(ErrorStr);SourceTableListObj.focus();return;}
if (SelectedObjectTable=='') {ErrorStr='请选择目标数据库表';alert(ErrorStr);ObjectTableListObj.focus();return;}
if (!SearchPosition(TableCorrListObj,SelectedSourceTable+'---'+SelectedObjectTable))
{
AddOption=document.createElement("OPTION");
AddOption.text=SelectedSourceTable+'---'+SelectedObjectTable;
AddOption.value='---'+SelectedSourceTable+'---'+SelectedObjectTable;
TableCorrListObj.add(AddOption);
}
else alert(SelectedSourceTable+'---'+SelectedObjectTable+'已经添加了');
}
function DelTableCorr()
{
var TableCorrListObj=document.UpdateForm.TableCorrList,i=0;
while (i<TableCorrListObj.options.length)
{
if (TableCorrListObj.options(i).selected) {TableCorrListObj.options.remove(i);}
else i=i+1;
}
}
function SearchPosition(ObjectObj,Str)
{
var i=0;
for(i=0;i<ObjectObj.length;i++)
{
if (ObjectObj.options(i).text.indexOf(Str)!=-1) return true;
}
return false;
}
function SubmitData()
{
var TableCorrListObj=document.UpdateForm.TableCorrList,i=0,TempStr='';
if (TableCorrListObj.length>=1)
{
document.UpdateForm.TableCorrInfo.value='';
for(i=0;i<TableCorrListObj.length;i++)
{
if (TempStr=='') TempStr=TableCorrListObj.options(i).value;
else TempStr=TempStr+'$$$'+TableCorrListObj.options(i).value;
}
document.UpdateForm.TableCorrInfo.value=TempStr;
document.UpdateForm.submit();
}
else alert('请添加表对应关系');
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -