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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

C# SQL server 2000 xml question

  • 03-08-2006 1: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,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, 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