Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programmatically Add Table In Data Environment
Message
From
13/08/2002 12:06:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
13/08/2002 11:21:29
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00689012
Message ID:
00689194
Views:
24
David,
Unintentionally leaded to a misunderstanding :)
IMHO it's not better to code in form load but have tables in DE actually. If they're in DE they're opened faster (as at least the docs say).
Here I said 'better' just I thought it's too early for Tut to programmatically play with DE. Personally I use DE as much as possible. Sometimes it turns out to be hardly controllable that way, then I use load or init (what you said is one reason). For your sample I still open in DE but with row buffering, in init index then set to table buffering.
DE problems mainly stem from once it's loaded you should be tricky to play with its objects. Controls on form binds them, causing you not to be free all the time for a DE.closetables, opentables (ie: with a grid it's really very hard to get a consistent behaviour).
Cetin

>Cetin,
>
>Could you explain why it is better to code the file opens in the form load? It seems like it would be advantageous to be able to reference the properties as objects. However, I do know that in some cases things have not worked as I expected when I did this. For example, I wanted to change the buffering mode of my cursor to 3, create an index, then set it to 5. When I did it in the form load with cursorsetprop() I didn't have any problem. When I attempted to modify the Buffermodeoverride property in the DE, It gave me some sort of error message - I don't recall exactly what - something to the effect that the data environment would have to be reloaded before changes took effect. Are these the types of things that happen that make it better to code it in the load?
>
>TIA for your consideration
>
>
>
>>>I'm Sorry But I'm just a beginner of it..
>>>
>>>I still don't get it what you told me...
>>>
>>>What does it mean ????
>>>
>>>Hope you tell me more.....
>>>thanks...
>>
>>
>>with thisform.Dataenvironment
>> .CloseTables
>> .Addobject('mycursor','cursor')
>> with .myCursor
>>   .Alias = 'myAlias'
>>   .Database = 'c:\myPath\myDBC.dbc'
>>   .cursorsource = 'myTable'
>> endwith
>> .OpenTables
>>endwith
>>
Relation would be in the same manner. However if you don;t have a good reason do not try to do this in dataenvironment. Instead directly code in load or init depending on your needs. ie: form.Load
>>
>>use myTable in 0 order tag myTag
>>use myParent in 0
>>select myParent
>>set relation to myField into myTable
>>
>>Cetin
Ç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
Previous
Reply
Map
View

Click here to load this message in the networking platform