Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exporting XML from queries
Message
From
07/10/2008 18:39:32
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01353485
Message ID:
01353514
Views:
31
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform