关于数据重复的问题~~
bjuwy 2005-10-23 04:48:20 本来要求一个数据窗口中找出某一列不能重复,现在因为员工的误操作,重复了一些,
我现在就是要把这些重复的找出来,只保留一个,我是这样写的:
SetPointer(HourGlass!)
dw_1.settransobject(sqlca)
dw_1.retrieve(em_1.text,em_2.text)
string ls_djh,ls_djh1="",ls_djh2
string ls_t,ls_djh11,ls_djh22
int i,j
hpb_1.maxposition=dw_1.rowcount()
hpb_2.maxposition=dw_1.rowcount()
sle_1.text="有"+string(dw_1.rowcount())+"张单据"
for i=1 to dw_1.rowcount()
ls_djh1=dw_1.getitemstring(i,'djh1')
hpb_1.position=i
for j=1 to dw_1.rowcount()
ls_djh2=dw_1.getitemstring(j,'djh1')
hpb_2.position=j
if string(ls_djh1)=string(ls_djh2) then
ls_djh11=dw_1.getitemstring(i,'djh')
ls_djh22=dw_1.getitemstring(j,'djh')
ls_t=st_1.text
st_1.text=ls_t+'~r'+ls_djh11+"和"+ls_djh22+"重复"
// st_1.text=ls_t+'~r'+ls_djh1
end if
next
next
SetPointer(arrow!)
messagebox("","找完了!")
我觉得这样好慢啊~
大家帮我看看我有没有改进的地方