Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADDOBJECT
Message
De
15/09/1999 12:18:10
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
15/09/1999 11:55:53
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00264974
Message ID:
00265037
Vues:
16
>John,
>
>I am trying to add tables to the data environment of a form. This needs to be done dynamically since the number of tables and their names are customizable by the user. I really don't have a problem with AddObject creating a cursor as much as the rest of the code to attach the tables to the data environment. This is my Code which will not work.
>
>Dime gsMyCursor(5)
>For myx = x To ALEN(gnTables)
> With ThisForm.DataEnvironment
> .AddObject(gsMyCursor(myx), "cursor")
> .gsMyCursor(myx).DataBase = "c:\MyFolder\Apps\Church Books\churchdata.dbc"
> .gsMyCursor(myx).CursorSource = gaTables(myx)
> .CloseTables()
> .OpenTables()
> EndWith
>Next myx


Where is the name of object ? gsMyCursor elements seem to be all .f.

dimension myCursors[5]
myCursors[1] = "table1"
myCursors[2] = "table2"
myCursors[3] = "table3"
myCursors[4] = "table4"
myCursors[5] = "table5"
with thisform.dataenvironment
.CloseTables
for ix = 1 to alen(myCursors)
.AddObject("Cursor"+padl(ix,2,"0"),"Cursor")
with eval("Cursor"+padl(ix,2,"0"))
.Database = "c:\MyFolder\Apps\Church Books\churchdata.dbc"
.Cursorsource = myCursors[ix]
endwith
endfor
.OpenTables
endwith

* But there is an easier way if it's a private data session
* Load event
dimension myCursors[5]
myCursors[1] = "table1"
myCursors[2] = "table2"
myCursors[3] = "table3"
myCursors[4] = "table4"
myCursors[5] = "table5"
for ix = 1 to alen(myCursors)
use (myCursors[ix]) in 0
endforCetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform