>I am running queries in the Sql Manager and getting the result set in XML. When I save the XML result I xcannot read it with XmlToCursor() or the XmlAdapter class.
>
>I have used the following syntax strings in my query:
>
>select * from mytable for xml raw
>
>select * from mytable for xml raw, elements, xmlschema
>
>select * from mytable for xml raw, elements, xmlschema, root('mydata')
>
>select * from mytable for xml auto
>
>select * from mytable for xml auto, elements, xmlschema
>
>select * from mytable for xml auto, elements, xmlschema, root('mydata')
>
>I also tried the XmlDate directive as well and many other variations.
>
>When I try to read it with Fox I get error, "Only one top level element is allowed in an XML Document". Does anyone have an idea on the proper syntax to get a result set in Xml that I can take as generated and I can save to a drive and read with Fox?
>
>
>Thanks,
>
>MW
Something like this might help:
handle = Sqlstringconnect('Driver={SQL Native Client};Trusted_Connection=yes;server=.\sqlexpress')
?SQLExec(m.handle,;
'select * from Northwind..customers for xml raw,xmldata',;
'myResult')
SQLDisconnect(0)
lcTemp = Forcepath( Sys(2015)+'.xml', Sys(2023))
Set Textmerge To Memvar lcXML Noshow
Set Textmerge On
\\<data>
Scan
\\<<EVALUATE( 'myResult.'+FIELD(1))>>
Endscan
\</data>
Set Textmerge To
Set Textmerge Off
Local lo As Xmladapter
lo = Createobject('XMLAdapter')
lo.LoadXML( m.lcXML )
lo.Tables(1).ToCursor
Browse
Cetin