Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

C# SQL server 2000 xml question

  • 03-08-2006 02:29AM
    #1
    Registered Users, Registered Users 2 Posts: 174 ✭✭


    I have a simple sql server 2000 table and I want to pull the info out of it into a c# webservice app so it can pass back the results to the calling client.

    I was hoping to use XmlDocument to store the xml results and pass that back to the client.

    Has anyone constructed an xmldocument object using a sql query or does anyone have any ideas, as everything I try doesn't appear to work too well

    Cheers


Comments

  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey




  • Registered Users, Registered Users 2 Posts: 1,454 ✭✭✭Smoggy


    As you pull the data out fo sql server you store it in a Dataset, the Dataset object has a method for converting to xml (GetXml). Alternatly the better method would be to return the data from sql server to ur calling client as xml, I think for that you use "FOR XML EXPLICIT", but you would have to read about that.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Afiak you can return a dataset through the webservice e.g.
    [Webmethod]
    public DataSet foo()
    {
        // does something
        return dataset;
    }
    

    Visual Studio/.Net framework will convert it to XML for you just like the GetXml() method. This may only be version 2 though.

    <edit>
    Yep, you can. .Net will serialise the dataset to xml for you - however the consumer may not recognise the schema used.


Advertisement