为什么在DataWindow添加一个安段之后所有的ls_key都变成"no

zp2002 2003-01-21 01:54:45
以下是源代码,this指的是一个DataWindow,我在DataWindow中的一些字段栏的Tag中填有描述文字,而一些没有,原先运行时是好好的,所有的有描述的也能抓出来,ls_key='yes',但是在其中添加了一个数据库中表的字段与Tag值之后,所有的ls_key都变成了"no",不能得出其值了。
请问这是什么原因造成的?

li_kcount = 0
for li_i = 1 to li_ccount
ls_num = "#" + string(li_i)
ls_str = ls_num + ".Key"
ls_key = this.Describe(ls_str)//添加一个字段后,所有的ls_key都变成了"no"
if ls_key = "no" then continue
ls_str = ls_num + ".Name "
ls_cname = this.Describe(ls_str)
this.ui_s_keyname[li_kcount+1] = ls_cname
ls_str = ls_num + ".ColType"
ls_type = this.Describe(ls_str)
li_p = Pos(ls_type, "(")
if li_p <> 0 then
ls_type = Left(ls_type, li_p - 1)
end if
this.ui_s_keytype[li_kcount+1] = ls_type
li_kcount += 1
next


为什么在DataWindow添加一个安段之后所有的ls_key都变成"no
...全文
51 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuebuctxy 2003-01-21
  • 打赏
  • 举报
回复
update属性变了吧
看一下rows->update properities
当数据存在主次表时,当更新了次表数据后,主表数据在后台有更变时。可利用刷新主表当前行的方法重显主表数据。 /************************************************************ 函数名称: f_refresh_currentrow(adw) 功 能: 刷新DW当前行数据,不可刷新NO update or 带arguments的DW 参数说明: adw 目标DW 返 回 值: integer 成功返回1,失败返回-1 作 者: sean 创建时间: 2010年8月18日 ************************************************************/ string ls_dataobject string ls_keys[] //key Column Name string ls_dbname[] //key field Name string ls_coltype[] //field style string ls_tablenm //table name string ls_condition //sql Condition long ll_currentrow //Current Row numeric long ll_column //Column count integer i datawindow ldw datastore ldatastore ldw=adw if ldw.rowcount( )=0 then return -1 elseif trim(ldw.describe( "datawindow.table.arguments"))<>'?' then messagebox('','刷新数据窗口当前行失败!,数据窗口需要参数',exclamation!) return -1 else ll_currentrow=ldw.getrow( ) FOR ll_column = 1 TO long(ldw.object.datawindow.column.count)//key names If ldw.Describe("#"+string(ll_column)+".key") ='yes' Then i++ ls_keys[i]=ldw.Describe("#"+string(ll_column)+".name") ls_dbname[i]=ldw.Describe("#"+string(ll_column)+".dbname") ls_coltype[i]=ldw.Describe("#"+string(ll_column)+".coltype") End If NEXT if upperbound(ls_keys[])=0 then messagebox('','刷新数据窗口当前行失败!,没有主键',exclamation!) return -1 else ls_tablenm=left(ls_dbname[1],pos(ls_dbname[1],'.') -1) //table name for i=1 to upperbound(ls_keys[]) if pos('numb,deci,long,',LeftA(ls_coltype[i],4) +',')>0 then ls_condition+="and "+ls_dbname[i]+"="+string(f_getitem(ldw,ll_currentrow,ls_keys[i])) else ls_condition+="and "+ls_dbname[i]+"='"+string(f_getitem(ldw,ll_currentrow,ls_keys[i]))+"'" end if next ls_condition=mid(ls_condition,4) //sql Condition ldatastore=create datastore ldatastore.dataobject=ldw.dataobject ldatastore.settransobject( sqlca) if f_addwhere_retrieve(ldatastore,ls_condition)=1 then if ldatastore.rowcount( )=1 then ldw.object.data[ll_currentrow]=ldatastore.object.data[1] ldw.setitemstatus( ll_currentrow, 0, primary!, NotModified!) //if ldw.getrow( )<>ll_currentrow then ldw.scrolltorow( ll_currentrow) end if else messagebox('','刷新数据窗口当前行失败!,条件语法错误',exclamation!) return -1 end if destroy ldatastore end if end if

611

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧