pb中怎么一条一条的让数据库里数据显示在mle_1控件里面,当点击发送后,显示下一条

qq_29098449 2015-07-30 04:21:50
这样的一个窗口,怎么来写代码啊?求教了
...全文
1943 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
mmw_bj 2015-08-09
  • 打赏
  • 举报
回复
赞成版主的方法,用数据窗口是最简单,代码应该也是最少的。
pjjia 2015-08-06
  • 打赏
  • 举报
回复
申明实例变量 datastore ids long il_row = 0,il_rowcount 窗体打开时创建ids string ls_sql,ls_temp,ls_syntax ids = create datastore ls_sql="SELECT * FROM citybusdatalist " ls_syntax=SQLCA.SyntaxFromSql(ls_sql,"",ls_temp) if len(ls_temp)>0 then MessageBox("error","SyntaxFromSQL caused these errors:" + ls_temp) return end if ids.Create(ls_syntax ,ls_temp) ids.SetTransObject(sqlca) 窗口关闭时 destroy ids cb_1点击时 string ls_colValue1,ls_colValue2,ls_colValue3, ls_colValue4,ls_colValue5,ls_colValue6,ls_select,ls_mleText,num,num1[],str if il_row = 0 or il_row = il_rowcount then ids.reset() ids.retrieve() il_rowcount = ids.rowcount() if il_rowcount > 0 then il_row++ else il_row = 0 end if end if if il_row > 0 then ls_colValue1=string(ids.GetItemnumber(il_row ,'uid')) ls_colValue2=ids.GetItemString(il_row ,'tablename') ls_colValue3=ids.GetItemstring(il_row ,'mflag') ls_colValue4=string(ids.GetItemdatetime(il_row ,'mdate')) ls_colValue5=ids.GetItemstring(il_row ,'idstr') ls_colValue6=ids.GetItemstring(il_row ,'id') if ls_colValue2 = '从业人员' then //从业人员检索 if ls_colValue3 = 'd' then ls_mleText=ls_mleText+'&'+'司机删除' + ',' else select name into :num from dt_career where id = :ls_colValue1; ls_mleText=ls_mleText+'&'+'司机修改' +','+ls_colValue5+',' +num+','+str+','+ls_colValue4 end if end if if ls_colValue2 = '车辆' then //车辆检索 if ls_colValue3 = 'd' then select color into :ls_select from lt_vehicle where id = :ls_colValue1; ls_mleText=ls_mleText+'&'+'车辆删除' +',' + ls_select else select color into :ls_select from lt_vehicle where id = :ls_colValue1; ls_mleText=ls_mleText+'&'+'车辆修改' +',' + ls_select end if end if if ls_colValue2 = '企业' then //企业检索 if ls_colValue3 = 'd' then select proprietorName into :ls_select from lt_proprietorbase where id = :ls_colValue1; ls_mleText=ls_mleText+'&'+'单位删除' +',' + ls_select else select proprietorName into :ls_select from lt_proprietorbase where id = :ls_colValue1; ls_mleText=ls_mleText+'&'+'单位修改' +',' + ls_select end if end if mle_1.text=ls_mleText end if
eclat2299 2015-08-03
  • 打赏
  • 举报
回复
最後一行改用 mle_1.text=ls_mleText + mle_1.text 点击发送后後資料, 會在最上方
qq_29098449 2015-08-03
  • 打赏
  • 举报
回复
引用 3 楼 eclat2299 的回复:
最後一行改用 mle_1.text=ls_mleText + mle_1.text 点击发送后後資料, 會在最上方
不要全部显示在mle中,第一条显示在mle中几秒后或者cb_1点击后就显示下一条数据,不是全部显示在一个mle_1中
qq_29098449 2015-07-31
  • 打赏
  • 举报
回复
]
引用 1 楼 lzp_lrp 的回复:
首先使用数据窗口(或者游标)把数据从数据库中取出,然后赋值到mle_1里,点击发送后,把下一条数据写到mle_1里
datastore lds
string ls_sql, ls_syntax, ls_temp, ls_colValue1,ls_colValue2,ls_colValue3, ls_colValue4,ls_colValue5,ls_colValue6,ls_select,ls_mleText,num,num1[],str 
long ll_rown
long  i 


lds=create datastore

ls_sql="SELECT  *  FROM citybusdatalist "
ls_syntax=SQLCA.SyntaxFromSql(ls_sql,"",ls_temp)
if len(ls_temp)>0 then
MessageBox("error","SyntaxFromSQL caused these errors:" + ls_temp)
return
end if
lds.Create(ls_syntax ,ls_temp)
lds.SetTransObject(sqlca)
lds.retrieve()

    ll_rown= 1 
	
ls_colValue1=string(lds.GetItemnumber(ll_rown,'uid'))
ls_colValue2=lds.GetItemString(ll_rown,'tablename')
ls_colValue3=lds.GetItemstring(ll_rown,'mflag')
ls_colValue4=string(lds.GetItemdatetime(ll_rown,'mdate'))
ls_colValue5=lds.GetItemstring(ll_rown,'idstr')
ls_colValue6=lds.GetItemstring(ll_rown,'id')

if  ls_colValue2 = '从业人员' then                                 //从业人员检索

	if ls_colValue3 = 'd' then
		 
        ls_mleText=ls_mleText+'&'+'司机删除'  + ',' 
   else 
		
		select name into :num from dt_career where id = :ls_colValue1;
//		DECLARE C1 CURSOR FOR                           //定义C1游标
//         select name,gender  from  dt_career where id = :ls_colValue1;      //取值
//         OPEN C1;                                   //打开游标
//         DO WHILE sqlca.SQLCODE=0              
//         FETCH C1 INTO:num,:str;           //将游标内的数据一条条存放到自定义变量里
//         LOOP
//         CLOSE C1; 
         ls_mleText=ls_mleText+'&'+'司机修改' +','+ls_colValue5+',' +num+','+str+','+ls_colValue4
   end if
end if


 if  ls_colValue2 = '车辆' then                                         //车辆检索
	if ls_colValue3 = 'd' then
	   select color into :ls_select from lt_vehicle where id = :ls_colValue1;
        ls_mleText=ls_mleText+'&'+'车辆删除'  +',' + ls_select 
   else 
		select color into :ls_select from lt_vehicle where id = :ls_colValue1;
         ls_mleText=ls_mleText+'&'+'车辆修改'  +',' + ls_select 
		end if
 end if
 
  if  ls_colValue2 = '企业' then                                       //企业检索
	if ls_colValue3 = 'd' then
	   select proprietorName into :ls_select from lt_proprietorbase where id = :ls_colValue1;
        ls_mleText=ls_mleText+'&'+'单位删除'  +',' + ls_select 
   else 
		select proprietorName into :ls_select from lt_proprietorbase where id = :ls_colValue1;
         ls_mleText=ls_mleText+'&'+'单位修改'  +',' + ls_select 
		end if
 end if


destroy lds

mle_1.text=ls_mleText 
我的代码是这样的,帮忙看一下,取出是所有的值,差的是一条一条的取出,和点击发送后出现下一条
WorldMobile 2015-07-31
  • 打赏
  • 举报
回复
首先使用数据窗口(或者游标)把数据从数据库中取出,然后赋值到mle_1里,点击发送后,把下一条数据写到mle_1里

754

社区成员

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

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