在线等待:数据管道一难题???急需解决!!!
有以下一段程序,为什么 li_rc 的值总是 -1,而我在PipeStart事件中设的messagebox("","")也没执行,难道以下代码的start函数没有执行吗???
//user是一个数据管道用户对象
Transaction it_source
user ip_create
it_source=create transaction
it_source.dbms=sqlca.dbms
it_source.database=sqlca.database
it_source.userid=sqlca.userid
it_source.dbpass=sqlca.dbpass
it_source.logid=sqlca.logid
it_source.logpass=sqlca.logpass
it_source.servername=sqlca.servername
it_source.dbparm=sqlca.dbparm
connect using it_source;
if it_source.sqlcode<>0 then
messagebox("Source Connect Err",it_source.sqlerrtext)
return
end if
ip_create=create user
dw_1.settransobject(sqlca)
//dp_item是一个数据管道
ip_create.dataobject="dp_item"
int li_rc
li_rc=ip_create.start(it_source,sqlca,dw_1)
dw_1.retrieve()
if li_rc<>1 then
messagebox("Create New TAble","Error return code:"+string(li_rc))
end if
commit;
destroy ip_create
disconnect using it_source;
destroy it_source
dw_2.settransobject(sqlca)
dw_2.retrieve()
问题点数:20、回复次数:16Top
1 楼cskkk(龙骑)回复于 2002-08-03 19:39:56 得分 0
有点难度............Top
2 楼tiantianpb(第一菜鸟!)回复于 2002-08-03 19:41:11 得分 0
Description
Executes a pipeline object, which transfers data from the source to the destination as specified by the SQL query in the pipeline object. This pipeline object is a property of a user object inherited from the pipeline system object.
Controls
Pipeline objects
Syntax
pipelineobject.Start ( sourcetrans, destinationtrans, errordatawindow
{, arg1, arg2,..., argn } )
Argument Description
pipelineobject The name of a pipeline user object that contains the pipeline object to be executed
sourcetrans The name of a transaction object with which to connect to the source database
destinationtrans The name of a transaction object with which to connect to the target database
errordatawindow The name of a DataWindow control in which to display the pipeline-error DataWindow. You don't need to assign a DataWindow object to the DataWindow control. If you do it, will be replaced with the one used by the pipeline
argn
(optional) One or more retrieval arguments as specified for the pipeline object in the Data Pipeline painter
Return value
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.
//返回值好象没有-1的
Top
3 楼cskkk(龙骑)回复于 2002-08-03 19:44:15 得分 0
To :
tiantianpb(阿九)
在pb8.0中:
-1: 表示管道打开失败Top
4 楼tiantianpb(第一菜鸟!)回复于 2002-08-03 19:47:50 得分 0
user ip_create//是基于pipeline的标准对象吗?封装了吗?
Top
5 楼cskkk(龙骑)回复于 2002-08-03 20:00:49 得分 0
封装,什么意思???请指点:
我就是用:new->object->standard Class->pipeline
然后再保存为:user
有什么错误吗????
Top
6 楼heliang(流浪的风筝)回复于 2002-08-03 20:08:11 得分 0
你是在pb 环境下还是单个exe执行文件,
单个exe执行文件 编译是要使用资源文件将管道对象包含进去。
如果在pb下, 你下断点跟踪一下,应该很好发现。Top
7 楼cskkk(龙骑)回复于 2002-08-03 20:16:53 得分 0
不行。
我是在pb8.0环境的支持下Top
8 楼tiantianpb(第一菜鸟!)回复于 2002-08-03 20:21:20 得分 0
你是将表复制到同一个数据库中吗?看看你的代码好象是的Top
9 楼cskkk(龙骑)回复于 2002-08-03 20:25:38 得分 0
是这样的,但是start函数执行有误,不知道错在哪Top
10 楼tiantianpb(第一菜鸟!)回复于 2002-08-03 20:30:27 得分 10
看看sqlca的值是什么?
Top
11 楼tiantianpb(第一菜鸟!)回复于 2002-08-03 20:31:21 得分 0
看看sqlca的值是什么?
Top
12 楼sfw(vc beginner)回复于 2002-08-03 21:47:33 得分 0
看看我的这段代码:运行通过了的,或许对你有帮助,:)
int ll_rc
long ll_stime,ll_etime
wf_connect_db()
i_pipe=create up_pipe
i_pipe.st_read=st_read
i_pipe.st_written=st_written
i_pipe.st_errors=st_errors
ll_stime=cpu()
i_pipe.dataobject="datapipe"
ll_rc=i_pipe.start(i_src,i_dst,dw_error)
ll_etime=cpu()
st_time.text=string((ll_etime - ll_stime)/1000,"##0.0")+"秒"
if ll_rc <> 1 then
messagebox("数据管道执行错误代码:",string(ll_rc))
return
end if
//wf_connect_db()
dw_sou.settransobject(i_src)
dw_sou.retrieve()
dw_des.settransobject(i_dst)
dw_des.retrieve()
Top
13 楼cskkk(龙骑)回复于 2002-08-03 22:13:35 得分 0
看了不错
但其中的:st_read,st_written....哪来的,请说明一下
还有:cpu()函数在这里用有什么用,Top
14 楼lanying(蓝鹰)(问个不休)回复于 2002-08-03 22:22:51 得分 0
看pb自带的例子,有
st_read...是usercontrol的实例变量,类型为statictext
Top
15 楼sfw(vc beginner)回复于 2002-08-03 22:24:17 得分 10
st_read,st_written是两个用来显示已读记录,已写记录的两个static text
的名字,cpu()函数在这里是统计数据管道整个过程中所需要的时间,最后也有一个static text :st_time显示出来,我知道的就这么多了,呵呵Top
16 楼cskkk(龙骑)回复于 2002-08-04 09:24:00 得分 0
非常感谢!!!
:)Top




