Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to make CursorAdadpter update remote data
Message
De
18/02/2003 03:18:06
 
 
À
17/02/2003 07:38:06
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00754031
Message ID:
00754361
Vues:
19
Thanks Cetin

AFter your suggestion it now works. I must have chewed up that updatename list somehow.


>>If I modify the cursor generated by this code, I would expect TABLEUPDATE(.T.) to impact these changes on the remote data.
>>The TABLEUPDATE command is not updating the Remote data set.
>>I think this is because I have to create my own update method, but I am very hazy as how to do this.
>>The help seems to indicate that this code can be generated automatically but this does not work for me.
>>Can anyone show me what I should be doing?
>>
>>
>>
>>
>>*The CursorFill() method is part of the PEMs of this new baseclass. Everytime it´s called, it will use the SelectCmd property to get the data and fill the cursor. We could use the class above like this:
>>PUBLIC oCustomersData
>>oCustomersData = CreateObject("CustomersData")
>>
>>BROWSE nowait
>>
>>
>>
>>*The CursorAdapter new class gives us new opportunities to extend our data cursors, it helps us to work with local and remote data, from Native VFP data to ODBC, ADO and XML.
>>
>>*Its use is pretty straight-forward. Take a look at the next sample. We start by defining a new class, based on the CursorAdapter baseclass:
>>
>>Define CLASS CustomersData as CursorAdapter
>>
>>     *-- Let´s define the DataSourceType as "Native" (VFP data)
>>     DataSourceType="Native"
>>
>>     *-- Let´s define the name of the alias that should be created.
>>     Alias="curCustomers"
>>
>>     *-- Let´s define the command that will generate the data to fill the cursor.
>>     SelectCmd = "select * from Customer"
>>
>>     Procedure Init
>>          *-- Once the object is created, let´s fill the cursor.
>>          this.CursorFill()
>>     EndProc
>>EndDefine
>>
>>
>>*Remember: once the object is created, there will be a curCustomers cursor opened at the browse.
>>
>>*Do you want a little more fun? Well, let´s take a look at this sample:
>>
>>Define CLASS CustomersData as CursorAdapter
>>
>>     *-- Now, we want to define the type of the data source as ODBC
>>     DataSourceType="ODBC"
>>
>>     Alias="curCustomers"
>>
>>     *-- We can define a "Cursor Schema"
>>     CursorSchema = ;
>>             "customerid c(5),companyname c(30),contactname c(30),"+;
>>             " contacttitle c(30), address c(30), city c(30), country"+;
>>             " c(30)"
>>
>>     SelectCmd = ;
>>             "select customerid, companyname, contactname, "+;
>>             " contacttitle, address, city, country from Customers"
>>
>>
>>
>>
>>     *-- Remember the CursorSetProp() function?  :)
>>     Tables = "Customers"
>>     KeyFieldList = "customerid"
>>     UpdatableFieldList = "companyname"
>>     UpdateNameList = "companyname,curcustomers.companyname customers.companyname"
>>
>>     Procedure Init
>>
>>          *-- Add a property at run-time that holds a Connection Handle.
>>          This.AddProperty('Connection',;		
>>                       SQLSTRINGCONNECT(;
>>                         "Driver=SQL Server;Server=TE-13716\DEVTEST;"+;
>>                         "Description=Northwind, Int Security;"+;
>>                         "DATABASE=Northwind"))
>>
>>          *-- The data source is our Connection Handle
>>          This.DataSource = This.Connection
>>
>>          This.CursorFill()
>>
>>     EndProc  	
>>EndDefine
>>
>
>Mark,
>Assuming you meant second class try :
>UpdateNameList = "customerid customers.customerid, companyname customers.companyname"
>
>Cetin
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform