Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01008137
Message ID:
01008147
Vues:
23
>I have the test code below. It works fine. It returns the data
>I want in the format I want.
>
>Some questions:
>
>1) When the object oCursor is destroyed, the table closes. Any way
>to make it persist?

This makes sense to me as the lifetime of the CA should be the same as the cursor.

>
>2) If the table can be persisted after the CA class is destroyed, can/how
>are changes submitted back to the data source?
>
>3) How would you impliment this? Obviously the structure required for each call
>to this code might be different. It seems inifficient to have to create a PRG
>for each table I want ot access.

IMO, a different CA is needed for each table.

>
>4) How would you use the CA in a multi tier environment? If I create a class
>based on session, with this code inside it, the resulting cursor is then in a
>different session. We don't use DBC's. All tables are free tables.

The CA is only applicable in the data tier. It would do a CUSORTOXML() and send the data via XML to the Business objects, which will do an XMLTOCURSOR() is needed or pass the XML on to the UI, which will do an XMLTOCURSOR().

Is there are reason you only use free tables? DBCs provide several advantages.


>
>Thanks!
>
>
>
>CLOSE DATABASES ALL
>
>LOCAL oCursor as CursorAdapter
>LOCAL aErrors[1]
>
>USE d:\projects\testdata\smts\station
>
>oCursor = createobject("CursorAdapter")
>
>WITH oCursor
>
>.Alias = "MyStations"
>.CursorSchema = "STName C(04), Afil C(20), Mkt C(20), Buyer C(2)"
>.DataSourceType = "Native"
>.SelectCmd = "SELECT StatName, Afiliate, Market, BInit FROM Station WHERE StatName = 'KTLA'"
>.KeyFieldList = "STName"
>.Tables = "Station"
>.UpdatableFieldList = "STName, Afil, Mkt, Buyer"
>.UpdateNameList = "STName Station.StatName, Afil Station.Afiliate, Mkt Station.Market,
>                  Buyer Station.BInit"
>
>IF .CursorFill(.T.)
>  BROWSE
>  TABLEUPDATE(1)
>ELSE
>  AERROR(aErrors)
>  MESSAGEBOX(aErrors[2],48,"Error Occured")
>ENDIF
>
>ENDWITH
>
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform