Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter Question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00980399
Message ID:
00980419
Views:
44
Ok, What I'd like to do is pull the data from the source
table into a different structure. The field names might not
be the same in the app as in the source table.

Is the CursorSchema the way to do it?


>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
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform