string sServerName,sDBName,sUserName,sDBId
string sServerName1,sDBName1,sUserName1,sDBId1
long l_return
//连接另一台机上的数据库sql2000
sServerName=ProfileString('config.ini',"loding","servername","")//获得总部服务器名
sDBName=profilestring('config.ini',"loding","dbname","")
sUserName=profilestring('config.ini',"loding","username","")
sDBId=profilestring('config.ini',"loding","dbid","")
serverdb =create transaction
serverdb.dbms="Mss Microsoft sql server"
serverdb.servername=sServerName
serverdb.database=sDBName
serverdb.logid=sUserName
serverdb.logpass=sDBId
serverdb.autocommit=false
serverdb.dbparm="connectstring='dsn="+sDBName+";uid="+sUserName+";pwd="+sDBId+"'"
CONNECT USING serverdb;
// 连接本地数据库sql2000
sServerName1=ProfileString('config.ini',"loding1","servername1","")//获得本地服务器名
sDBName1=profilestring('config.ini',"loding1","dbname1","")
sUserName1=profilestring('config.ini',"loding1","username1","")
sDBId1=profilestring('config.ini',"loding1","dbid1","")
localdb =create transaction
localdb.dbms="Mss Microsoft sql server"
localdb.servername=sServerName1
localdb.database=sDBName1
localdb.logid=sUserName1
localdb.logpass=sDBId1
localdb.autocommit=false
localdb.dbparm="connectstring='dsn="+sDBName1+";uid="+sUserName1+";pwd="+sDBId1+"'"
CONNECT USING localdb;
//上传到总部数据库:局域网或广域网
//pipeline p_loding
p_loding=create pipeline
p_loding.dataobject="p_hz"
l_return=p_loding.start(localdb,serverdb,dw_1)
if l_return=1 then
messagebox("提示","运行成功")
else
messagebox("提示","运行失败"+string(l_return))
ROLLBACK USING localdb;
ROLLBACK USING serverdb;
end if
p_loding.cancel()
DESTROY p_loding
DISCONNECT USING serverdb;
DISCONNECT USING localdb;
------解决方案--------------------
-4 要增加数据的表不在!
先建个表或 管道类型改add table
------解决方案--------------------
-3 是表已经存在了,
返回值的意义可以从f1的帮助里看
------解决方案--------------------
按F1看帮助。。
Integer. Returns 1 if it succeeds and a negative number if an error occurs. Error values are:
-1 Pipe open failed
-2 Too many columns
-3 Table already exists
-4 Table does not exist
-5 Missing connection
-6 Wrong arguments
-7 Column mismatch
-8 Fatal SQL error in source
-9 Fatal SQL error in destination
-10 Maximum number of errors exceeded
-12 Bad table syntax
-13 Key required but not supplied
-15 Pipe already in progress
-16 Error in source database
-17 Error in destination database
-18 Destination database is read-only
If any argument's value is NULL, Start returns NULL.