<% Option Explicit %>
<!--#include file="inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="inc/PublicFun.asp" -->
<%
Dim DBC,UpdateConn
Set DBC = New DataBaseClass
DBC.ConnStr = "DBQ=" + server.mappath(UpdateDataBase) + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set UpdateConn = DBC.OpenConnection()
Set DBC = Nothing

Dim TableSOID
TableSOID = Request("TableSOID")
if TableSOID <> "" then
	Dim RSSearchObj,SourceTableFieldStr,ObjectTableFieldStr
	Set RSSearchObj = UpdateConn.Execute("Select * from DBSO,TableSO where DBSO.MainID=TableSO.DBSOID and TableSO.ID=" & TableSOID & "")
	if Not RSSearchObj.Eof then
		SourceTableFieldStr = ListAllFieldOfTable(RSSearchObj("SourceDBType"),RSSearchObj("SServer"),RSSearchObj("SourceDB"),RSSearchObj("SUser"),RSSearchObj("SPassWord"),RSSearchObj("STable"))
		ObjectTableFieldStr = ListAllFieldOfTable(RSSearchObj("ObjectDBType"),RSSearchObj("OServer"),RSSearchObj("ObjectDB"),RSSearchObj("OUser"),RSSearchObj("OPassWord"),RSSearchObj("OTable"))
		if Not (SourceTableFieldStr = "" OR ObjectTableFieldStr = "") then
%>
	<script language="JavaScript">
		parent.SetTableField('<% = SourceTableFieldStr %>','Source');
		parent.SetTableField('<% = ObjectTableFieldStr %>','Object');
	</script>
<%
		elseif SourceTableFieldStr = "" then
			%>
				<script language="JavaScript">
					parent.SetTableField('','Source');
					alert('列出源表字段出错');
				</script>
			<%
		elseif ObjectTableFieldStr = "" then
			%>
				<script language="JavaScript">
					parent.SetTableField('','Object');
					alert('列出目标表字段出错');
				</script>
			<%
		end if
	end if
end if
Set UpdateConn = Nothing
%>
<script language="JavaScript">
parent.SetBtnStatus(false);
</script>