Using XML Explicit Mode in SQL Server 2000

  • Dear everyone,

    I want to build XML document from SQL Server 2000 data.

    I am using Visual Studio.NET to run the following XML query:

    select 1 as tag , 0 as parent,

    sid as [StaffID!1!ID!element],

    sname as [StaffID!1!Name!element]

    from roytest for xml explicit;

    How can I output the query results to file in XML formats by using VS.NET and C#.NET?? Where is the related websites or reference ??

    Thanks much!!!!

    From,

    Roy

  • I don't have the means to test this (let me know if it works:satisfied:

    dim cmdXML as new SQLCommand ("xmlProc")

    dim xmlInput as XMLReader = cmdXML.ExecuteXML()

    dim xmlOutPut as new XMLTextWriter ("FileName", _

        System.Text.Encoding.Ascii)

    while xmlInput.Read()

      xmlOutPut.WriteNode (xmlInput, true)

    end while

    xmlOutPut.Flush() ' This may not be necessary

    Russel Loski, MCSD

    Russel Loski, MCSE Business Intelligence, Data Platform

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply