Hi All,
I've created a test program to explore the XML capabilites of the CursorAdapater Class but I'm having difficulty getting it automatically produce an UpdateGram as advertised in the documentation.
I have a simple XML document containing two "employee" nodes that match the CursorSchema in the attached code sample. The .prg runs without error, a cursor is created, and the cursor update is accomplished. The changes are reflected in the updategram created with the XMLUPDATEGRAM('employee') function. The UpdateGram property of the the CursorAdapter remains an empty string.
I've tried alternate setting of a number of CursorAdapter properties without any success. Anyone have any suggestions?
LOCAL CA AS CursorAdapter,oErr AS Exception,lcFile,lcSchema,lcGram1,lcGram2
CA = CREATEOBJECT('CursorAdapter')
SET MULTILOCKS ON
lcFile = [c:\development\vfp8\employee.xml]
lcSchema = [lastname C(40),firstname C(40),;
address C(60),city C(40),state C(2),zip C(5)]
TRY
WITH CA
.Alias = 'employee'
.DataSourceType = "XML"
.CursorSchema = lcSchema
.SelectCmd = lcFile
.UpdateCmdDataSourceType = "XML"
.InsertCmdDataSourceType = "XML"
.DeleteCmdDataSourceType = "XML"
.BufferModeOverride = 5
.CursorFill(.T.,.F.,512)
ENDWITH
GO BOTTOM
replace firstname WITH 'Sam'
lcGram1 = CA.UpdateGram
lcGram2 = XMLUPDATEGRAM('employee')
CATCH TO oErr
SUSPEND
FINALLY
SUSPEND
ENDTRY
Bob Tracy
Never engage in a battle of wits if you're only half armed.