Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create a new datasession programatically.
Message
From
03/02/1999 20:12:29
 
 
To
03/02/1999 18:04:02
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00183664
Message ID:
00183719
Views:
17
Creating and instanciating a Dataenvironment object won't in itself create a new datasession. AFAIK, the only way to do this is with a form.

But this is ok too, you can just use a dummy form's DE. Create a dummy form class, instanciate the form, check its datasessionID property and switch to that datasession.

Even better, create the form as an scx, and you can maintain the tables and views in the datasession with the form designer. You'll just have to set the form's visible property to .F.,

DO FORM MyDummyForm NAME oForm
lnNewDataSession = oForm.DataSessionID
lnOldDataSession = SET('DataSession')

SET DATASESSION TO lnNewDataSession

*************
*USE tables, do whatever processing here
*********
oForm.release

SET DATASESSION TO lnOldDataSession







>You need to create a new class based on the DataEnvironment base class programatically. You can't use the class designer to do this. Somthing like this:
>
>DEFINE CLASS MyDE AS DataEnvironment
>...
>PROCEDURE Init()
>   THIS.AddObject("Cursor1", "Cursor")
>   WITH .Cursor1
>      .CursorSource = "MyTable"
>      .Database = "MyDatabase"
>      .Alias = "MyTable"
>      .Order = "SomeOrder"
>   ENDWITH
>   ...
>ENDPROC
>...
>ENDDEFINE
>
>HTH
>
>>I want to programtaically create a new datasession, open a few tables, dow some work, then release the dataession restore the previous datasession as the current on.
>>
>>Basically, I want a new, private datasession programatically.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform