Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add column to a cursor
Message
De
04/12/2018 11:23:40
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01664052
Message ID:
01664060
Vues:
47
>Hi,
>
>Is there a trick to be able to add a column to a cursor created with XMLTOCURSOR()? I pass the following parameters to the XMLTOCURSOR():
>512+8192
>
>And then if you call ALTER TABLE ADD COLUMN CoName C(10), you get the error "Invalid operation on the cursor".
>
>Can I change anything in the parameter to XMLTOCURSOR() to all adding a column?
>
>TIA

Dmitry, you can set the cursor before import the XML data, with the extra column already in place.
CREATE CURSOR Sample (Column1 Char(10), Column2 Char(10), Column3 Char(10))

LOCAL Source AS String

TEXT TO m.Source NOSHOW FLAGS 1
<file>
	<row>
		<column1>data1</column1>
		<column2>data2</column2>
	</row>
</file>
ENDTEXT

XMLTOCURSOR(m.Source, "sample", 8192)

SELECT Sample
BROWSE

USE IN Sample
Or you could add it afterwards.
LOCAL Source AS String

TEXT TO m.Source NOSHOW FLAGS 1
<file>
	<row>
		<column1>data1</column1>
		<column2>data2</column2>
	</row>
</file>
ENDTEXT

XMLTOCURSOR(m.Source, "sample")

SELECT Sample
BROWSE

SELECT sample.*, SPACE(10) AS column3 FROM sample INTO CURSOR sample READWRITE

SELECT sample
BROWSE

USE IN Sample
An extra option: to use an XML schema to which the XML document would refer.
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform