CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  PowerBuilder >  基础类

在线等待:数据管道一难题???急需解决!!!

楼主cskkk(龙骑)2002-08-03 19:03:51 在 PowerBuilder / 基础类 提问

有以下一段程序,为什么   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

相关问题

  • jsp难题急需解决,谢谢
  • 访问数据库出错???急需解决!!!
  • odbc操作oracle数据库错误,急需解决,谢谢!
  • 急需解决
  • 急需解决
  • 急需解决!!
  • gird编辑单元格数据后更新数据问题,急需解决!
  • 公司分析数据网络出现问题,急需解决,急!
  • 大家请进,急需解决数据转换的文题?谢谢了.
  • javascript从数据库取出数据后赋给变量出现问题,急需解决...

关键词

  • 函数
  • source
  • 数据
  • 代码
  • 执行
  • 文件
  • cpu
  • start
  • ip
  • sqlca

得分解答快速导航

  • 帖主:cskkk
  • tiantianpb
  • sfw

相关链接

  • PowerBuilder类图书
  • PowerBuilder类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo