Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data Envrionment Quirks & Slow Opening Forms
Message
De
22/10/2004 02:54:14
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
00953449
Message ID:
00953634
Vues:
22
>Hi all,
>
>I just installed an application which starts in a C:\VFP folder and has a Global Variable set to the app's DBC path. I was shocked to see that Forms with Data Environments were opening VERY slowly.
>
>
>Since I've had various other systems up for years and never heard of this problem I wonder if all my other clients have a D drive mapped to a non-removable device or always have a CD in their D Drive.
>
>I am considering making Form modifications suggested in previous threads which use code similar to Doug Hennig's SetDataDirectory.
>


Hi There :)
Here is one old solutions for old known problem of hardcoded
database path in dataenvironment cursors.

You create public object based on this class and then just
add one line of code in each form DE.beforeopentables method.

It will change all database properties of de cursors at run
time according to setup provided in this object.
define class redirect_dataenvironment as custom

DataPath='C:\yourdatapath'

*** If u use more then one database/directory then          
*** u shld develop this method to respond correctly.

    procedure get_database
        lparameters cDatabaseName
        local cDatabaseName
        return addbs(this.DataPath) + cDatabaseName


    procedure redirect_de
        lparameters oDataEnvironment
        local i,j,db_name,arr_obj(1)
        amembers(arr_obj,oDataEnvironment,2)
        for i = 1 to alen(arr_obj)
            j = oDataEnvironment.&arr_obj(i) .baseclass
            if upper(alltrim(j)) = 'CURSOR'
                db_name=upper(justfname(allt(oDataEnvironment.&arr_obj(i) .database )))
                oDataEnvironment.&arr_obj(i) .database=this.get_database(allt(db_name))
                if !file(oDataEnvironment.&arr_obj(i) .database)
                    messagebox('['+oDataEnvironment.&arr_obj(i) .database+']'+chr(13)+;
                        'Not found Check your data')
                endif
            endif
        endfor


enddefine
So somewhere at the startup of application you create public object
Public oData
oData=createobject('redirect_dataenvironment')
and then in each form's de you add folowing line in BeforeOpenTables
method
***BeforeOpenTables

oData.redirect_de(this)
Solution hv to be upgraded to support free tables if you use them.


Best Regards
Sergio
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform