标题:vf表通过筛选set filter 后,多人读写速度慢,一人读写很快,谁能告诉我这是 ...
只看楼主
wabc327
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2021-2-4
结帖率:28.57%
已结贴  问题点数:20 回复次数:18 
vf表通过筛选set filter 后,多人读写速度慢,一人读写很快,谁能告诉我这是什么原因啊!
vf表通过筛选set filter 后,多人读写速度慢,一人读写很快,谁能告诉我这是什么原因啊!
搜索更多相关主题的帖子: 原因 set filter 速度 读写 
2022-06-01 18:19
xuminxz
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:40
帖 子:749
专家分:2475
注 册:2011-5-8
得分:3 
请说明:
1、后台数据库是什么?如果用VFP表,多人操作很难提高速度。
2、数据是否分组(每个操作员,只能操作指定部分数据)?如分组的标志字段是什么?
3、如没有分组,同一条数据是否有可能被一个以上操作员写入?


[此贴子已经被作者于2022-6-1 19:01编辑过]


dBase有人接盘了。
2022-06-01 18:59
wabc327
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2021-2-4
得分:0 
Vfp表 已按录入员分组  每个录入员只能对自己录入的记录修改、删除  多人员可添加记录 按条件读取全部记录
2022-06-01 19:54
zhken
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:11
帖 子:273
专家分:594
注 册:2012-9-21
得分:3 
改变一下设计思路,仅读取要修改记录,修改好后再对表进行锁定更新,效果会好很多
2022-06-01 20:18
wabc327
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2021-2-4
得分:0 
回复 4楼 zhken
能否给个事例啊 怎样锁定更新啊 小弟学习一下

[此贴子已经被作者于2022-6-1 22:03编辑过]

2022-06-01 22:02
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:3 
被那个快人锁定了吧
2022-06-02 07:16
hu9jj
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:红土地
等 级:贵宾
威 望:396
帖 子:11713
专家分:43267
注 册:2006-5-13
得分:3 
试试用select SQL 语句来筛选读取和更新表,可能效率会更高些。

活到老,学到老! http://www. E-mail:hu-jj@
2022-06-02 07:50
wabc327
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2021-2-4
得分:0 
回复 6楼 吹水佬

档案号文本框(有两个事件:第一个GotFocus)筛选后恢复所有以供再次筛选
sele b_dagl
set filter to
set order to dahpxmlh
go top               
档案号文本框(第二个lostFocus)主要是筛选后将顶记录其他C1文本控件赋值,这一步如果一人操作时还可以,人越多越慢
public wm_xm,wm_dah
wm_dah=this.value
*!*    mll="dah='"+wm_dah+"'"  
          mll="dah=wm_dah"         
    if len(alltrim(wm_dah))<7
        =messagebox('档案号不能为空,且必须7位以上长度!',0+16,'错误信息')
         
         
         
         ("enabled",.f.)
          retu
    endif
    set filter to &mll
    count to clfs  &&统计材料份数等同记录个数
    if clfs >0     
        sum ys to clys                                    
        go top               
        store dah to thisform.c1.txtdah.value
        store sfzh to thisform.c1.txtsfzh.value
        store xm to thisform.c1.txtxm.value
        wm_xm=xm                             
        store xb to thisform.c1.txtxb.value
        store csrq to thisform.c1.txtcsrq.value
        store jg to thisform.c1.Txtjg.value
        store mz to thisform.c1.Txtmz.value
        store zb to thisform.c1.Txtzb.value
        store zt to thisform.c1.Txtzt.value
        store dwmc to thisform.c1.Txtdwmc.value
        store zxbz to thisform.c1.Txtzxbz.value
        store "姓名:"+wm_xm+space(20)+"材料份数:"+allt(str(clfs))+space(20)+"材料页数:"+allt(str(clys)) to thisform.caption
        thisform.
    else
            messagebox('该档案信息未录入,不能补充材料',0+16,"错误信息")
            
            
            
            ("enabled",.f.)
              retu
    endif
    THISFORM.REFRESH


大类别文本框(有两个事件,click事件)
    thisform.C1.txtdnf.setfocus
大类别文本框(有两个事件,第二个lostFocus事件)这一步如果一人操作时还可以,人越多越慢
    public mll,mcx[2]
    mcx[1]=alltrim(thisform.c1.txtdah.value)
    sele b_lb
    mcx[2]=zclb
    mll=""
        if  alltrim(mcx[2])="1-" .or. alltrim(mcx[2])="2-" .or. alltrim(mcx[2])="3-" .or. alltrim(mcx[2])="5-" .or. alltrim(mcx[2])="6-" .or. alltrim(mcx[2])="7-" .or. alltrim(mcx[2])="8-"
            mll="mcx[2] = subs(yjmlh,1,2)"
        else
            if alltrim(mcx[2])="10-"
                mll="mcx[2] = subs(yjmlh,1,3)"
            else
                mll="mcx[2] = subs(yjmlh,1,4)"   
            endif
        endif
               mll="dah=mcx[1] .and. "+mll
        sele b_dagl
        set filter to
        set order to dahpxmlh
            set filter to &mll
            count to clfs
             sum ys to clys
            store "姓名:"+wm_xm+space(20)+"材料份数:"+allt(str(clfs))+space(20)+"材料页数:"+allt(str(clys)) to thisform.caption
             go top
        thisform.C1.txtdnf.setfocus        
        THISFORM.REFRESH


确定(click事件)这一步也是时而慢得很
SELE b_dagl
count to jls                        &&统计筛选类别后记录数
IF JLS>0            
    go bott                                &&指向记录尾
            jsq=len(rtrim(pxmlh))               &&删除了字符表达式后续空格后,返回结果字符串长度
            mlh_zdfs=val(subs(pxmlh,jsq-2,3))   &&取出最大份数
                    if jls = mlh_zdfs                         &&判断最大份数是否与该类别记录数相等
                            DO CASE
                                    CASE val(thisform.c1.txtdnf.value)<=JLS   
                                            blpxmlh1=subs(pxmlh,1,jsq-3)                                           &&取出需要补录的大类别,带空格排序目录号pxmlh
                                            blyjmlh = alltrim(subs(blpxmlh1,1,3))+alltrim(subs(blpxmlh1,4,7))      &&取出移交大类别,不带空格正常目录号zcmlh
                                            m_pxmlh=alltrim(THISFORM.C1.txtpxmlh.VALUE)            
                                            mlh_fs=val(subs(m_pxmlh,jsq-2,3))    &&mlh_fs=val(subs(pxmlh,jsq-2,3)  取表单第几份也可以或查找取出当前记录取出第几份  
                    
                        do while .not. bof() .and. alltrim(thisform.c1.txtdah.value) = dah .and. blpxmlh1=subs(pxmlh,1,jsq-3) .and. val(subs(pxmlh,jsq-2,3))>=mlh_fs   
                                                blpxmlh2=str(val(subs(pxmlh,jsq-2,3))+1,3)                          &&目录末位 第几份资料顺序加1
                        repl yjmlh with blyjmlh+alltrim(blpxmlh2),pxmlh with blpxmlh1+blpxmlh2,gjsy with alltrim(dah)+"-"+blyjmlh+alltrim(blpxmlh2)+'-'+alltrim(str(ys))
                                                skip -1
                                            enddo
                        insert into b_dagl (dah,xm,xb,mz,csrq,sfzh,zb,jg,dwmc,zt,pxmlh,yjmlh,clmc,clrq,ys,bz,gjsy,lry,lrrq);
values (alltrim(thisform.c1.txtdah.value),THISFORM.C1.txtxm.VALUE,THISFORM.C1.txtxb.VALUE,THISFORM.C1.Txtmz.VALUE,THISFORM.C1.txtcsrq.VALUE,;
THISFORM.C1.txtsfzh.VALUE,thisform.c1.Txtzb.value,thisform.c1.Txtjg.value,thisform.c1.Txtdwmc.value,thisform.c1.Txtzt.value,THISFORM.C1.txtpxmlh.VALUE,THISFORM.C1.txtyjmlh.VALUE,THISFORM.C1.txtclmc.value,;
THISFORM.C1.txtclrq.VALUE, val(THISFORM.C1.txtys.VALUE),THISFORM.C1.txtbz.VALUE,THISFORM.C1.txtgjsy.VALUE,THISFORM.C1.txtlry.VALUE,THISFORM.C1.txtlrrq.VALUE)         
                        CASE val(thisform.c1.txtdnf.value)=JLS+1
insert into b_dagl (dah,xm,xb,mz,csrq,sfzh,zb,jg,dwmc,zt,pxmlh,yjmlh,clmc,clrq,ys,bz,gjsy,lry,lrrq);
values (alltrim(thisform.c1.txtdah.value),THISFORM.C1.txtxm.VALUE,THISFORM.C1.txtxb.VALUE,THISFORM.C1.Txtmz.VALUE,THISFORM.C1.txtcsrq.VALUE,;
THISFORM.C1.txtsfzh.VALUE,thisform.c1.Txtzb.value,thisform.c1.Txtjg.value,thisform.c1.Txtdwmc.value,thisform.c1.Txtzt.value,THISFORM.C1.txtpxmlh.VALUE,THISFORM.C1.txtyjmlh.VALUE,THISFORM.C1.txtclmc.value,;
THISFORM.C1.txtclrq.VALUE, val(THISFORM.C1.txtys.VALUE),THISFORM.C1.txtbz.VALUE,THISFORM.C1.txtgjsy.VALUE,THISFORM.C1.txtlry.VALUE,THISFORM.C1.txtlrrq.VALUE)              
                                    OTHERWISE
                                             =messagebox('该档案目录无需补充,请确认“整理”后到档案目录管理中[添加]!',0+64,'提示信息')
                                             
                                             
                                             
                                             ("enabled",.f.)
                                             retu  
                            ENDCASE                    
                    
                    else
                            =messagebox('该档案目录未录入完整,不能补充目录,请到档案目录管理中[添加]补充完整!',0+64,'提示信息')
                             
                           
                           
                            ("enabled",.f.)
                            retu               
                    endif            
ELSE

                    if  JLS=0 AND val(thisform.c1.txtdnf.value)=1     && OR JLS = mlh_zdfs AND JLS+1=val(thisform.c1.txtdnf.value)   &&jls=0 and val(thisform.c1.txtdnf.value)=1 or
                        insert into   b_dagl (dah,xm,xb,mz,csrq,sfzh,zb,jg,dwmc,zt,pxmlh,yjmlh,clmc,clrq,ys,bz,gjsy,lry,lrrq);
                        values (alltrim(thisform.c1.txtdah.value),THISFORM.C1.txtxm.VALUE,THISFORM.C1.txtxb.VALUE,THISFORM.C1.Txtmz.VALUE,THISFORM.C1.txtcsrq.VALUE,;
THISFORM.C1.txtsfzh.VALUE,thisform.c1.Txtzb.value,thisform.c1.Txtjg.value,thisform.c1.Txtdwmc.value,thisform.c1.Txtzt.value,THISFORM.C1.txtpxmlh.VALUE,THISFORM.C1.txtyjmlh.VALUE,THISFORM.C1.txtclmc.value,;
THISFORM.C1.txtclrq.VALUE, val(THISFORM.C1.txtys.VALUE),THISFORM.C1.txtbz.VALUE,THISFORM.C1.txtgjsy.VALUE,THISFORM.C1.txtlry.VALUE,THISFORM.C1.txtlrrq.VALUE)
                    else
                         =messagebox('该档案目录无需补充,请确认“整理”后到档案目录管理中[添加]!',0+64,'提示信息')
                        
                        
                        
                         ("enabled",.f.)
                         retu
                    endif
ENDIF
                count to clfs
                 sum ys to clys
                store "姓名:"+wm_xm+"      "+"材料份数:"+allt(str(clfs))+"              "+"材料页数:"+allt(str(clys)) to thisform.caption
                go top        
                    THISFORM.GRID1.Refresh
                =messagebox("档案信息补充成功",0+64,"系统提示")
               

请您指教,万分感谢!


[此贴子已经被作者于2022-6-2 09:25编辑过]

2022-06-02 09:24
wabc327
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2021-2-4
得分:0 
回复 7楼 hu9jj
我已把程序传上来了 怎样用SQL语句优化 请指教
2022-06-02 09:48
wabc327
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2021-2-4
得分:0 
回复 6楼 吹水佬
大师 请帮忙看看呗 非常感谢!!!
jh.rar (17.51 KB)
2022-06-02 10:41



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-509237-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.058713 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved