免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5642 | 回复: 5

pb数据管道问题求解!!! [复制链接]

论坛徽章:
0
发表于 2006-12-27 08:55 |显示全部楼层
小弟刚开始接触pb,遇到一个数据管道的问题,执行管道后返回的结果老是 -1
以下是部分代码,pb8写的,请高手帮忙!谢谢!!!

forward
global type w_pipeline from window
end type
type st_4 from statictext within w_pipeline
end type
type st_3 from statictext within w_pipeline
end type
type st_2 from statictext within w_pipeline
end type
type st_1 from statictext within w_pipeline
end type
type cb_exit from commandbutton within w_pipeline
end type
type cb_cancel from commandbutton within w_pipeline
end type
type cb_run from commandbutton within w_pipeline
end type
type dw_error from datawindow within w_pipeline
end type
type st_error from statictext within w_pipeline
end type
type st_written from statictext within w_pipeline
end type
type st_read from statictext within w_pipeline
end type
type st_connect from statictext within w_pipeline
end type
end forward

global type w_pipeline from window
integer width = 2528
integer height = 1044
boolean titlebar = true
string title = "DU---dmÊý¾Ýµ¼Èë"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
st_4 st_4
st_3 st_3
st_2 st_2
st_1 st_1
cb_exit cb_exit
cb_cancel cb_cancel
cb_run cb_run
dw_error dw_error
st_error st_error
st_written st_written
st_read st_read
st_connect st_connect
end type
global w_pipeline w_pipeline

type variables
transaction trn_src
transaction trn_desc
//u_pipeline_student iu_pipeline
u_pipeline_student iu_pipeline
end variables

on w_pipeline.create
this.st_4=create st_4
this.st_3=create st_3
this.st_2=create st_2
this.st_1=create st_1
this.cb_exit=create cb_exit
this.cb_cancel=create cb_cancel
this.cb_run=create cb_run
this.dw_error=create dw_error
this.st_error=create st_error
this.st_written=create st_written
this.st_read=create st_read
this.st_connect=create st_connect
this.Control[]={this.st_4,&
this.st_3,&
this.st_2,&
this.st_1,&
this.cb_exit,&
this.cb_cancel,&
this.cb_run,&
this.dw_error,&
this.st_error,&
this.st_written,&
this.st_read,&
this.st_connect}
end on

on w_pipeline.destroy
destroy(this.st_4)
destroy(this.st_3)
destroy(this.st_2)
destroy(this.st_1)
destroy(this.cb_exit)
destroy(this.cb_cancel)
destroy(this.cb_run)
destroy(this.dw_error)
destroy(this.st_error)
destroy(this.st_written)
destroy(this.st_read)
destroy(this.st_connect)
end on

event open;//u_pipeline_student iu_pipeline
trn_src = create transaction

// Profile dm
SQLCA.DBMS = "ODBC"
SQLCA.AutoCommit = False
SQLCA.DBParm = "ConnectString='DSN=Excel Files;UID=WD='"

connect;// using trn_desc;

if trn_src.sqlcode <> 0 then
        st_connect.text = string(trn_src.sqlcode)+"&Ocirc;&acute;&Ecirc;&yacute;&frac34;&Yacute;&iquest;&acirc;&Aacute;&not;&frac12;&Oacute;&Ecirc;§°&Uuml;&pound;&iexcl;"
        return;
end if

trn_desc = create transaction

// Profile store111
SQLCA.DBMS = "SYC Adaptive Server Enterprise"
SQLCA.ServerName = "store111"
SQLCA.database="store111"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""

connect;// using trn_src;


if trn_src.sqlcode <> 0 then
        st_connect.text = string(trn_desc.sqlcode)+"&Auml;&iquest;±ê&Ecirc;&yacute;&frac34;&Yacute;&iquest;&acirc;&Aacute;&not;&frac12;&Oacute;&Ecirc;§°&Uuml;&pound;&iexcl;"
        return;
else
        st_connect.text = "&Ecirc;&yacute;&frac34;&Yacute;&iquest;&acirc;&Aacute;&not;&frac12;&Oacute;&sup3;&Eacute;&sup1;&brvbar;&pound;&iexcl;"
end if

st_read.text = "0"
st_written.text = "0"
st_error.text = "0"

//iu_pipeline=create u_pipeline_student
//iu_pipeline.dataobject="pipe_student"

end event
event close;destroy iu_pipeline
disconnect using trn_src;
destroy trn_src
disconnect using trn_desc;
destroy trn_desc
end event

type st_4 from statictext within w_pipeline
integer x = 882
integer y = 64
integer width = 841
integer height = 84
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "&sup3;&ouml;&acute;í&Ecirc;&yacute;&frac34;&Yacute;&ETH;&ETH;&Ecirc;&yacute;&frac14;°&sup3;&ouml;&acute;í&Auml;&Uacute;&Egrave;&Yacute;"
boolean focusrectangle = false
end type

type st_3 from statictext within w_pipeline
integer x = 105
integer y = 576
integer width = 457
integer height = 72
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long backcolor = 67108864
string text = "&ETH;&acute;&Egrave;&euml;&Ecirc;&yacute;&frac34;&Yacute;&ETH;&ETH;&Ecirc;&yacute;"
boolean focusrectangle = false
end type

type st_2 from statictext within w_pipeline
integer x = 105
integer y = 320
integer width = 457
integer height = 72
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "&para;&Aacute;&Egrave;&euml;&Ecirc;&yacute;&frac34;&Yacute;&ETH;&ETH;&Ecirc;&yacute;"
boolean focusrectangle = false
end type

type st_1 from statictext within w_pipeline
integer x = 96
integer y = 64
integer width = 526
integer height = 72
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long backcolor = 67108864
string text = "&Ecirc;&yacute;&frac34;&Yacute;&iquest;&acirc;&Aacute;&not;&frac12;&Oacute;×&acute;&Igrave;&not;"
boolean focusrectangle = false
end type

type cb_exit from commandbutton within w_pipeline
integer x = 1915
integer y = 600
integer width = 457
integer height = 128
integer taborder = 30
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "&Iacute;&AElig;&sup3;&ouml;"
end type

event clicked;close(parent)
end event

type cb_cancel from commandbutton within w_pipeline
integer x = 1906
integer y = 360
integer width = 457
integer height = 128
integer taborder = 20
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "&Ouml;&Otilde;&Ouml;&sup1;"
end type

event clicked;long ll_flag
ll_flag = iu_pipeline.cancel()
if ll_flag = 1 then
        messagebox("&Igrave;á&Ecirc;&frac34;","&Ecirc;&yacute;&frac34;&Yacute;&sup1;&Uuml;&micro;&Agrave;&Ouml;&acute;&ETH;&ETH;±&raquo;&Ouml;&Otilde;&Ouml;&sup1;&sup3;&Eacute;&sup1;&brvbar;&pound;&iexcl;"
else
        messagebox("&Igrave;á&Ecirc;&frac34;","&Ecirc;&yacute;&frac34;&Yacute;&sup1;&Uuml;&micro;&Agrave;&Ouml;&acute;&ETH;&ETH;&Ouml;&Otilde;&Ouml;&sup1;&Ecirc;§°&Uuml;&pound;&iexcl;"
end if

end event

type cb_run from commandbutton within w_pipeline
integer x = 1906
integer y = 124
integer width = 457
integer height = 128
integer taborder = 10
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "&Ocirc;&Euml;&ETH;&ETH;"
end type

event clicked;long ll_flag
string ls_return
//u_pipeline_student iu_pipeline
//iu_pipeline=create u_pipeline_student
//iu_pipeline.dataobject = "pipe_student"

iu_pipeline = Create u_pipeline_student

iu_pipeline.ist_read = st_read
iu_pipeline.ist_written = st_written
iu_pipeline.ist_error = st_error

iu_pipeline.DataObject = 'pipe_student'

//iu_pipeline.Start(trn_src,trn_desc,dw_error)
ll_flag = iu_pipeline.Start(trn_src,trn_desc,dw_error)
if ll_flag <> 1 then
        st_error.text = "&Ecirc;&yacute;&frac34;&Yacute;&sup1;&Uuml;&micro;&Agrave;&acute;ò&iquest;&ordf;&acute;í&Icirc;ó&pound;&not;&acute;í&Icirc;ó&acute;ú&Acirc;&euml;&Icirc;&ordf;&pound;&ordm;"+string(ll_flag)
        return;
//else st_error.text="&Ecirc;&yacute;&frac34;&Yacute;&acute;&laquo;&Euml;&Iacute;&sup3;&Eacute;&sup1;&brvbar;&pound;&iexcl;"
end if
//choose case ll_flag
//        case -1
//                ls_return=""
//        case -2
//                ls_return=""
//        case -3
//                ls_return=""
//        case -4
//                ls_return=""
//        case -5
//                ls_return=""
//        case -6
//                ls_return=""
//end choose
end event
type dw_error from datawindow within w_pipeline
integer x = 946
integer y = 432
integer width = 718
integer height = 300
integer taborder = 10
string title = "none"
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type

type st_error from statictext within w_pipeline
integer x = 896
integer y = 212
integer width = 855
integer height = 336
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 134217857
long backcolor = 67108864
string text = "&sup3;&ouml;&acute;í&Ecirc;&yacute;&frac34;&Yacute;&ETH;&ETH;&Ecirc;&yacute;&frac14;°&sup3;&ouml;&acute;í&Auml;&Uacute;&Egrave;&Yacute;"
boolean focusrectangle = false
end type

type st_written from statictext within w_pipeline
integer x = 105
integer y = 688
integer width = 475
integer height = 88
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 134217857
long backcolor = 67108864
string text = "&ETH;&acute;&Egrave;&euml;&Ecirc;&yacute;&frac34;&Yacute;&ETH;&ETH;&Ecirc;&yacute;"
boolean focusrectangle = false
end type

type st_read from statictext within w_pipeline
integer x = 101
integer y = 412
integer width = 475
integer height = 76
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 134217857
long backcolor = 67108864
string text = "&para;&Aacute;&Egrave;&euml;&Ecirc;&yacute;&frac34;&Yacute;&ETH;&ETH;&Ecirc;&yacute;"
boolean focusrectangle = false
end type

type st_connect from statictext within w_pipeline
integer x = 101
integer y = 172
integer width = 677
integer height = 84
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 134217857
long backcolor = 67108864
string text = "&Ecirc;&yacute;&frac34;&Yacute;&iquest;&acirc;&Aacute;&not;&frac12;&Oacute;×&acute;&Igrave;&not;"
boolean focusrectangle = false
end type

论坛徽章:
0
发表于 2006-12-27 15:43 |显示全部楼层
.Start是-1的话,是Pipe open failed

论坛徽章:
0
发表于 2007-07-12 14:49 |显示全部楼层
为什么是打开失败啊,能不能说说是什么地方有问题啊,谢了

论坛徽章:
0
发表于 2007-07-14 17:22 |显示全部楼层
请大家帮帮我,非常感谢,为此事弄得我郁闷的,拜托了

论坛徽章:
0
发表于 2007-07-18 14:28 |显示全部楼层

回复 #4 pandu 的帖子

请在程序中使用调试的方法确认以下的内容

1. 程序中的数据库连接是否成功
2. datawindow object是否正常

论坛徽章:
17
处女座
日期:2013-08-27 09:59:352015亚冠之柏太阳神
日期:2015-07-30 10:16:402015亚冠之萨济拖拉机
日期:2015-07-29 18:58:182015年亚洲杯之巴勒斯坦
日期:2015-03-06 17:38:17摩羯座
日期:2014-12-11 21:31:34戌狗
日期:2014-07-20 20:57:32子鼠
日期:2014-05-15 16:25:21亥猪
日期:2014-02-11 17:32:05丑牛
日期:2014-01-20 15:45:51丑牛
日期:2013-10-22 11:12:56双子座
日期:2013-10-18 16:28:17白羊座
日期:2013-10-18 10:50:45
发表于 2007-07-18 14:43 |显示全部楼层
兄弟你搞的太离谱了。
trn_src = create transaction

// Profile dm
trn_src.DBMS = "ODBC"
trn_src.AutoCommit = False
trn_src .DBParm = "ConnectString='DSN=Excel Files;UID=WD='"

connect using trn_src;

if trn_src.sqlcode <> 0 then
        st_connect.text = string(trn_src.sqlcode)+"Ô´Êý¾Ý¿âÁ¬½Óʧ°Ü£¡"
        return;
end if

trn_desc = create transaction

// Profile store111
trn_desc .DBMS = "SYC Adaptive Server Enterprise"
trn_desc .ServerName = "store111"
trn_desc .database="store111"
trn_desc .LogId = "sa"
trn_desc .AutoCommit = False
trn_desc .DBParm = ""

connect using trn_desc;

这样子才是对的。你src和dst都使用默认的SQLCA怎么可能对呢。搞搞清楚。SQLCA是默认的全局transaction,而你实际定义的别两个transaction自己却没用上。

[ 本帖最后由 myworkstation 于 2007-7-18 14:44 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

SACC2021中国系统架构师大会

【数字转型 架构重塑】2021年5月20日-22日第十三届中国系统架构师大会将在云端进行网络直播。

大会为期3天的议程,涉及20+专场,近120个主题,完整迁移到线上进行网络直播对会议组织来说绝非易事;但考虑到云端会议的直播形式可以实现全国各地技术爱好者的参与,也使ITPUB作为技术共享交流平台得到更好的普及,我们决定迎难而上。
http://sacc.it168.com/


大会官网>>
  

北京盛拓优讯信息技术有限公司. 版权所有 16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP