Any idea how to export an xml documnet from ms sql 2008 using vb.net into a
folder some where? I am running an SP that generates the xml already.
Thanks,
Eric
> Any idea how to export an xml documnet from ms sql 2008 using vb.net into
> a folder some where? I am running an SP that generates the xml already.
http://msdn.microsoft.com/en-us/library/system.io.file.createtext.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
> Any idea how to export an xml documnet from ms sql 2008 using vb.net
> into a folder some where? I am running an SP that generates the xml
> already.
I would offer something different than Mark:
http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.aspx
NOTE that this assumes you are getting a full XML document, with root tags,
rather than an XML snippet. SQL Server can do both.
peace and grace,
--
Gregory A. Beamer (MVP)
Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
*******************************************
> I would offer something different than Mark:
>
> http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.aspx
I took from the OP that he had already fetched a well-formed XML document
from SQL Server and simply wanted to know how to save it do disk...
> I took from the OP that he had already fetched a well-formed XML
> document from SQL Server and simply wanted to know how to save it do
> disk...
I am a bit TOO XML oriented in many cases. LOL
Peace and Grace,
Looking at the code in that link, I am not sure!! That means I need to loop
through all lines?
http://msdn.microsoft.com/en-us/library/system.io.file.createtext.aspx
Dim cmd As New SqlCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo.XML_MenuOptions"
Thanks,
Eric
"Mark Rae [MVP]" <ma...@markNOSPAMrae.net> wrote in message
news:uoMpGFHi...@TK2MSFTNGP06.phx.gbl...
[please don't top-post]
>>> Any idea how to export an xml documnet from ms sql 2008 using vb.net
>>> into a folder some where? I am running an SP that generates the xml
>>> already.
>> http://msdn.microsoft.com/en-us/library/system.io.file.createtext.aspx
> Looking at the code in that link, I am not sure!! That means I need to
> loop through all lines?
Look at some of the other methods of the file object, e.g.
http://msdn.microsoft.com/en-us/library/ms143356.aspx
Thanks for your reply. Do you know of any sample somewhere?
Another problem is when I ran the SP within the MS SQL 2008 it generates the
XML as a fine file.
Running the below code somehow I am getting an error like this: Invalid at
the top level of the document. Error processing. When tryuing to see the
value of the cmd.CommanText.
But this is an OK file which already used all the time. (Copy and paste from
the ms sql server).
Dim cmd As New SqlCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo.XML_MenuOptions"
Using ProductWriter As XmlWriter = XmlWriter.Create(cmd.CommandText)
End Using
Thanks,
Eric
> Thanks for your reply. Do you know of any sample somewhere?
After having a "discussion" with Mark, I think this might answer your
question:
http://tinyurl.com/y9trqjr
It is a very simple save to a file from SQL Server XML kind of answer. As
you know you are dealing with valid XML, the addition of the XML classes is
probably overkill.
"Gregory A. Beamer" <NoSpamM...@comcast.netNoSpamM> wrote in message
news:Xns9CF08E81...@207.46.248.16...