Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor Database property fix up code
Message
De
16/02/2005 10:29:10
 
 
À
16/02/2005 04:22:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00986971
Message ID:
00987446
Vues:
39
Hi Srdjan,

Thank you so much for this code. This is precisely what I was looking for without having to re-invent the wheel!

Best regards,

-=Gary

>>Hi,
>>
>>Could anyone point me in the direction of some Cursor object Database path "fix-up" code?
>>
>>Thanks,
>
>Hi There
>
>Here is solution I am using from 1997 (VFP5) enabling me to confortably use
>unlimited number of databases (multiple company/year/projdata datasets)
>without any problems. It is also aplicable to reports dataenvironments.
>
>It is class object changing database property to all DE cursors at run time.
>
>At the begining, object has to be instantiated as public (e.g 'oSystem' )
>so all forms can will be able to call it.
>Then all form can call it (single line) from method DE.BeforeOpenTable passing entire DE as parameter.
>
>
>public cServerDataDir,oSystem
>oSystem=createobject('redirect_dataenvironment')
>cServerDataDir = '\\someserver\RealRunTimePath' &&Should normaly come from some ini file
>
>* Then you have to insert tiny call to this object from every form DE ;
>
>* DE.BeforeOpenTables method
>oSystem.form_de(this)
>
>
>
>And here is class object that does it.
>(You can upgrade it for more complex path constructions.)
>
>
>define class redirect_dataenvironment as custom
>
>    procedure get_database
>        lparameters cDatabaseName
>        local cDatabaseName
>
>        *** Here you build your own path construction for
>        *** multiple databases,
>        *** instead of simple one I used for my sample
>        *** with one database
>
>        return addbs(cServerDataDir) + 'tastrade.dbc'
>
>    procedure form_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))
>            endif
>        endfor
>
>
>enddefine
>
>
>
>
>I never used free tables, so it does not covers them
>but you can provide for it easily.
>
>Hope this helps you.
>Rgds++
-=Gary
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform