Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C# SQL server 2000 xml question

Options
  • 03-08-2006 2:29am
    #1
    Registered Users 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 Posts: 15,443 ✭✭✭✭bonkey




  • Registered Users Posts: 1,466 ✭✭✭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 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