Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to ALIAS a CA the same as its VFP table?
Message
 
To
04/12/2006 18:50:02
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01174105
Message ID:
01174845
Views:
13
>>>>>>There is almost nothing that can't be done with VFP :-)
>>>>>>But when you on the way to convert your application from VFP NATIVE database to some other back end, I don't think that opening the table before invoke CA CursorFill() method is the way to go. This is just my opinion of course.
>>>>>>
>>>>>
>>>>>Any particular reasons?
>>>>>
>>>>>Thanks,
>>>>>Aleksey.
>>>>
>>>>Yes,
>>>>If I want to move to SQL Server, but have no time to convert all my forms I will prefer to use ADO recordset or ODBC one (not for VFP 9 tables) when I build CA, just to make sure that I won't miss something.If I must use the table before CursorFill() method what will happens with my form where I have a 20-30 tables opened? Also when I finish convert I must go through all my form and remove all code where I open my tables. This can be done in CA class, but after finishing conversion I mus remove that code from my class.
>>>>
>>>
>>>What is the answer to the question: "If I must use the table before CursorFill() method what will happens with my form where I have a 20-30 tables opened?" What exactly will happen?
>>>
>>>Thanks,
>>>Aleksey.
>>
>>In BeforeOpenTables of the form I must have:
>>
>>USE MyNatoveVFPTable1 ALIAS SomeAliasThatCAWillExpect1 IN 0
>>USE MyNatoveVFPTable2 ALIAS SomeAliasThatCAWillExpect2 IN 0
>>USE MyNatoveVFPTable3 ALIAS SomeAliasThatCAWillExpect3 IN 0
>>....
>>USE MyNatoveVFPTable20 ALIAS SomeAliasThatCAWillExpect20 IN 0
>>
>>
>>
>>Of course all this could be done in CA class, but what if I have some CA that get data from many tables and uses many joins?
>>Are you sure that using USE .... ALIAS and after that base CA to that Alias is easier way?
>
>Borislav,
>uses a SELECT with files sourceTable or DBC!tableName (NATIVE = DBF backend),
>if it has need VFP open the table:
>
>CLEAR
>SET MULTILOCKS ON
>
>CREATE TABLE testCAAlias (f1 I, f2 I)
>INSERT INTO testCAAlias values(1,1)
>INSERT INTO testCAAlias values(2,2)
>
>USE
>
>*USE testCAAlias ALIAS SomeOtherAlias IN 0
>
>LOCAL oCA as CursorAdapter
>oCA=CREATEOBJECT("CursorAdapter")
>
>oCA.DataSourceType="NATIVE"
>oCA.SelectCmd="select * from testCAAlias"
>oCA.Tables="testCAAlias"
>oCA.KeyFieldList="f1"
>oCA.UpdatableFieldList="f1,f2"
>oCA.UpdateNameList="f1 testCAAlias.f1, f2 testCAAlias.f2"
>oCA.BufferModeOverride= 5
>
>oCA.Alias = "testCAAlias_"
>
>?oCA.CursorFill()
>*SELECT testCAAlias
>
>INSERT INTO testCAAlias_ VALUES (3,3)
>DELETE FROM testCAAlias_ WHERE f1=2
>UPDATE testCAAlias_ SET f2 =11 WHERE f1=1
>
>SELECT testCAAlias
>?ALIAS()
>LIST
>
>SELECT testCAAlias_
>?ALIAS()
>LIST
>
>?TABLEUPDATE(.T.)
>
>SELECT testCAAlias
>?ALIAS()
>LIST
>
>CLOSE TABLES all
>USE testCAAlias
>LIST
>
Thank you Fabio, but the question was how to create a CA that have alias as native table, so no changes to to be made in forms or any other part of the application.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform