pb datawindow中使用blob字段

 

 

字段设置如图:

 

1

 

datawindow语法


release 8;
datawindow(units=0 timer_interval=0 color=15793151 processing=0 HTMLDW=no print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no ole.client.class="DataWindow" ole.client.name="Untitled" )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=4452 color="536870912" )
table(column=(type=char(32) updatewhereclause=yes key=yes name=id dbname="T_Svt_Unit.id" )
 column=(type=char(4099) update=yes updatewhereclause=no name=link dbname="T_Svt_Unit.link" )
 column=(type=char(4099) updatewhereclause=no name=content dbname="T_Svt_Unit.content" )
 column=(type=char(50) updatewhereclause=yes name=name dbname="T_Svt_Unit.name" )
 column=(type=blob name=blob_1 dbname="content" )
 column=(type=blob name=blob_2 dbname="brief" )
 retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"T_Svt_Unit~" ) COLUMN(NAME=~"T_Svt_Unit.id~") COLUMN(NAME=~"T_Svt_Unit.link~") COLUMN(NAME=~"T_Svt_Unit.content~") COLUMN(NAME=~"T_Svt_Unit.name~")WHERE(    EXP1 =~"T_Svt_Unit.id~"   OP =~"=~"    EXP2 =~":id~" ) ) ARG(NAME = ~"id~" TYPE = string) " update="T_Svt_Unit" updatewhere=0 updatekeyinplace=yes arguments=(("id", string)) )
tableblob (band=detail table="T_Svt_Unit" keyclause="id=:id" template="" id=5 x="338" y="12" height="172" width="247" border="2"  oleclass="Word.Document.8" clientname="'单位详介'" name=blob_1 visible="0" )
text(band=detail alignment="0" text="简介(图像):" border="0" color="128" x="0" y="132" height="60" width="352" html.valueishtml="0"  name=brief_t visible="1"  font.face="宋体" font.height="-10" font.weight="400"  font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=detail alignment="0" text="联系方式:" border="0" color="128" x="0" y="1708" height="60" width="274" html.valueishtml="0"  name=link_t visible="1"  font.face="宋体" font.height="-10" font.weight="400"  font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=2 alignment="0" tabsequence=20 border="2" color="33554432" x="9" y="1776" height="1012" width="3127" format="[general]" html.valueishtml="0"  name=link visible="1" edit.limit=4099 edit.case=any edit.focusrectangle=no edit.autoselect=no edit.autohscroll=yes edit.hscrollbar=yes edit.imemode=0 edit.vscrollbar=yes  font.face="宋体" font.height="-10" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
compute(band=detail alignment="2" expression=" trim(name )"border="4" color="255" x="795" y="24" height="104" width="1550" format="[GENERAL]" html.valueishtml="0"  name=compute_1 visible="1"  font.face="宋体" font.height="-16" font.weight="700"  font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
tableblob (band=detail table="T_Svt_Unit" keyclause="id=:id" template="" id=6 x="9" y="220" height="1472" width="3127" border="2"  oleclass="Paint.Picture" clientname="~"~"" name=blob_2 visible="1" )
button(band=detail text="修改描述"filename=""action="0" border="0" color="33554432" x="2720" y="108" height="92" width="256" vtextalign="0" htextalign="0"  name=b_2 visible="1"  font.face="宋体" font.height="-10" font.weight="400"  font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="67108864" )
button(band=detail text="显示描述"filename=""action="0" border="0" color="33554432" x="2720" y="8" height="92" width="256" vtextalign="0" htextalign="0"  name=b_1  tag="" visible="1"  font.face="宋体" font.height="-10" font.weight="400"  font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="67108864" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" netscapelayers="0" )
 

 

代码部分 b_1是显示,b_2是修改

 

if row < 1 then return
if dwo.name = 'b_2' then
 oleactivate(row,'blob_1',0)
end if
if dwo.name = 'b_1' then
 dw_temp.dataobject=this.dataobject
 dw_temp.settransobject(sqlca)
 dw_temp.retrieve(string(this.object.id[1]))
 dw_temp.oleactivate(1,'blob_1',0)
end if

 

 

 

 

 

 

另一种做法,不在datawindow中显示

 

 

if dwo.name='b_load' then
 li_value = GetFileOpenName("选择图片文件",ls_docname,ls_named)
 IF li_value = 1 THEN
  if f_readfile(lb_fj,ls_docname)=1 then
   if ll_picid>0 then
    ll_picid=this.getitemdecimal(row,'pictureid')
    UPDATE T_Svt_Picture SET PicName=:ls_named WHERE PictureId=:ll_picid ; 
   else
    ll_picid=gf_getid('T_Svt_Picture')
    INSERT INTO T_Svt_Picture ( PictureId,PicName,detaillogId ) 
       VALUES ( :ll_picid,:ls_named, :ld_detaillogId);     
   end if
   if sqlca.sqlcode<0 then
    rollback;
    messagebox('系统提示','数据保存失败')
    return
   end if
   updateblob T_Svt_Picture set PicBlob=:lb_fj
     where pictureid=:ll_picid;
   if sqlca.sqlcode<0 then
    rollback;
    messagebox('系统提示','图片保存失败')
    return
   else
    commit;
    //int li_temp=row
    this.retrieve(dw_6.object.detaillogId[dw_6.getrow()])
    //this.scrolltorow( li_temp)
   end if  
  end if
 end if
elseif dwo.name='b_look' then
  selectblob PicBlob into :lb_fj from T_Svt_Picture
   where pictureid=:ll_picid;
  if sqlca.sqlcode<>0 then
   messagebox('系统提示','资料附件读取失败')
   return
  end if
  ls_docname='c:/cnsmisworktemp'
  if not DirectoryExists(ls_docname) then CreateDirectory(ls_docname)
  ls_docname=ls_docname+dw_10.object.picname[row]
  if f_writefile(lb_fj,ls_docname)=1 then
   if ShellExecuteA(Handle(parent),ls_null,ls_docname,ls_null,ls_null, 1) > 32 then
    return
   else
    messagebox('系统提示','系统打开文件出错')
    return
   end if
  end if
elseif dwo.name='b_add' then
 if dw_6.modifiedcount( )>0 then
  messagebox("系统提示","请先保存救助记录的内容,在增加图片!")
  return
 end if
 ll_newrow=this.insertrow( 0)
 this.object.bureauid[ll_newrow]=ll_bureauid
 this.object.pictureid[ll_newrow]=gf_getid('T_Svt_Picture')
 this.object.detaillogid[ll_newrow]=ld_detaillogId
 this.scrolltorow( ll_newrow) 
elseif dwo.name='b_del' then
 if this.rowcount()>0 then
  if messagebox("提示","请确定是否要删除此图片!",Question!,YesNoCancel!,3)=1 then
   this.deleterow( this.getrow()) 
   if this.update( )=1 then
    commit;
   else
    rollback;
   end if
  end if
 end if
elseif dwo.name='b_save' then
 this.accepttext()
 
 if this.update( )=1 then
  commit;
  messagebox('系统提示','保存成功')
 else
  rollback;
  messagebox('系统提示','保存失败')
 end if
end if

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值