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:
00980399
Message ID:
00980408
Vues:
34
Your CursorSchema should be:

cust_id datatype(width), company C(30), contact c(40)

...just like a table structure, use the correct data types, width and precisions for each field you are retrieving. Get rid of CLOSE DATABASE ALL as well. The cursor associated with the CA will be closed if you just set loCursor = null at the end of your code.

>I'm not sure about the usage of the 'CursorSchema' property. I'm getting the
>error "Invalid key column 'cust_id'" when I run this.
>
>
>LOCAL loCursor AS CursorAdapter
>LOCAL laErrors[1]
>
>OPEN DATABASE (_samples + "data\testdata")
>
>loCursor = CREATEOBJECT("CursorAdapter")
>
>WITH loCursor
>
>	.Alias = "CustomerCursor"
>	.DataSourceType = "Native"
>	.SelectCmd = "select cust_id, company, contact from customer where country = 'Brazil'"
>	.KeyFieldList = "cust_id"
>	.Tables	 = "CUSTOMER"
>	.UpdatableFieldList = "cust_id, company, contact"
>	.UpdateNameList = "cust_id customer.cust_id, company customer.company, contact customer.contact"
>	.CursorSchema = "Col1 C(25), Col2 C(25), Col3 C(25)"
>	
>	IF .CursorFill(.T.)
>	
>		BROWSE
>		TABLEUPDATE(1)
>	
>	ELSE
>	
>		AERROR(laErrors)
>		MESSAGEBOX(laErrors[2])
>	
>	ENDIF
>
>	CLOSE DATABASES ALL
>	
>ENDWITH
>
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform