对方把相关功能用PB封装好了,也给出了PB调用的例子,我没用过PB,在Delphi中转化不来,哪位知道的请帮忙解决,在线给分。
oleobject loo_1
adoresultset ado_timu
datastore ds_timu
long ret
loo_1 = loo_base.gettimu(sfzh, xm, chelei, ksyy, jw,ksrq,zkr, xxzh)
ado_timu = create adoresultset
ado_timu.setrecordset(loo_1)
ds_timu = create datastore
ds_timu.createfrom(ado_timu)
long j,k
ds_timu.setsort('th,a')
ds_timu.sort()
for k = 1 to ds_timu.rowcount()
if ds_timu.object.ttype[k] = 'c' then
i ++
dw_1.insertrow(i)
dw_1.setitem(i,1,ds_timu.getitemstring(i,'timu'))
dw_1.setitem(i,2,ds_timu.getitemstring(i,'xz_a'))
dw_1.setitem(i,3,ds_timu.getitemstring(i,'xz_b'))
dw_1.setitem(i,4,ds_timu.getitemstring(i,'xz_c'))
dw_1.setitem(i,6,ds_timu.getitemstring(i,'havepic'))
dw_1.setitem(i,7,ds_timu.getitemstring(i,'picfile'))
dw_1.setitem(i,8,ds_timu.getitemnumber(i,'th'))
else
j ++
dw_2.insertrow(j)
dw_2.setitem(j,1,ds_timu.getitemstring(j,'timu'))
dw_2.setitem(j,3,ds_timu.getitemstring(j,'havepic'))
dw_2.setitem(j,4,ds_timu.getitemstring(j,'picfile'))
dw_2.setitem(j,5,ds_timu.getitemnumber(j,'th'))
end if
next
destroy ds_timu
dw_1.scrolltorow(1)
dw_2.scrolltorow(1)
上面是对方给出的例子,在Delphi中如何实现???(如解决了本题,本人将多给100分)

解决方案 »

  1.   

    oleobject loo_1  //ole对象
    adoresultset ado_timu  //ado数据集
    datastore ds_timu  //pb里的数据存储,相当于delphi中的TQuery
    long ret   
    loo_1 = loo_base.gettimu(sfzh, xm, chelei, ksyy, jw,ksrq,zkr, xxzh)  //获取object
    ado_timu = create adoresultset  //创建一个实例
    ado_timu.setrecordset(loo_1)   //获取数据集
    ds_timu = create datastore   //创建数据存储实例
    ds_timu.createfrom(ado_timu)  //根据语法创建
    long j,k
    ds_timu.setsort('th,a')   //设置排序,列名是th,升序
    ds_timu.sort()            //排序生效
    for k = 1 to ds_timu.rowcount()  //循环,从第一行,到最后一行
    if ds_timu.object.ttype[k] = 'c' then  //如果该行的,ttype列值是c
    i ++                         //i加1
    dw_1.insertrow(i)            //数据窗口dw_1插入一空行
    dw_1.setitem(i,1,ds_timu.getitemstring(i,'timu'))   //先读,然后给timu赋值
    dw_1.setitem(i,2,ds_timu.getitemstring(i,'xz_a'))  //先读,然后给'xz_a赋值
    dw_1.setitem(i,3,ds_timu.getitemstring(i,'xz_b'))  //先读,然后给xz_b赋值
    dw_1.setitem(i,4,ds_timu.getitemstring(i,'xz_c'))  //先读,然后给xz_c赋值
    dw_1.setitem(i,6,ds_timu.getitemstring(i,'havepic'))  //先读,然后给havepic赋值
    dw_1.setitem(i,7,ds_timu.getitemstring(i,'picfile'))  //先读,然后给picfile赋值
    dw_1.setitem(i,8,ds_timu.getitemnumber(i,'th'))  //先读,然后给th赋值
    else  
    j ++ 
    dw_2.insertrow(j)  //数据窗口dw_2新增一空行
                       //下面也是赋值
    dw_2.setitem(j,1,ds_timu.getitemstring(j,'timu'))
    dw_2.setitem(j,3,ds_timu.getitemstring(j,'havepic'))
    dw_2.setitem(j,4,ds_timu.getitemstring(j,'picfile'))
    dw_2.setitem(j,5,ds_timu.getitemnumber(j,'th'))
    end if
    next
    destroy ds_timu  //销毁创建的对象,相当于释放内存
    dw_1.scrolltorow(1)  //dw_1将第一行设为当前行
    dw_2.scrolltorow(1)  //dw_2将第一行设为当前行
      

  2.   

    对方是不是做了一个Ocx控件?
      

  3.   

    看上面的解释是创建了一个com组件
    如果是delphi可以将该组件安装注册成一个控件用的,很简单的
      

  4.   

    是COM组件的话,delphi菜单 component->import activeX control  : add COM组件,并安装,一般会在samples页里面加上控件的,可以用
      

  5.   

    同意yuehaiyang,基本上相当于打开一个数据集,然后在不同的窗体上显示出来.
      

  6.   

    你可以让他用pb写一个函数,把以上的代码包含在涵数中,最后你只需在delphi中用涵数就可以了