.NET dataset

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    #1

    .NET dataset

    I'd like to load xml contents to my dataset from an XML
    document in memory. The dataset.ReadXML requires a file
    on drive.

    Is there a way to do this from xmldoc in memory? Goal is
    to use data source to bind xmldoc to datagrid control.
  • Mikael Gustavsson

    #2
    Re: .NET dataset

    Hi!

    The dataset has more than one way to read data. One of them is by a
    System.IO.TextR eader and another with System.Xml.XmlR eader. I have never
    used the XmlReader, but with the other one you can read the xml from a
    string.

    DataSet ds = new DataSet();
    string myXml = GetXmlData();
    ds.ReadXml(new System.IO.Strin gReader(myXml)) ;

    Now the dataset should contain the xml data.

    I hope this helps you out!

    //Mikael

    "Mark" <LisaCook40@yah oo.com> wrote in message
    news:39c801c374 c2$c5458190$a60 1280a@phx.gbl.. .[color=blue]
    > I'd like to load xml contents to my dataset from an XML
    > document in memory. The dataset.ReadXML requires a file
    > on drive.
    >
    > Is there a way to do this from xmldoc in memory? Goal is
    > to use data source to bind xmldoc to datagrid control.[/color]


    Comment

    • Mikael Gustavsson

      #3
      Re: .NET dataset

      Hi!

      The dataset has more than one way to read data. One of them is by a
      System.IO.TextR eader and another with System.Xml.XmlR eader. I have never
      used the XmlReader, but with the other one you can read the xml from a
      string.

      DataSet ds = new DataSet();
      string myXml = GetXmlData();
      ds.ReadXml(new System.IO.Strin gReader(myXml)) ;

      Now the dataset should contain the xml data.

      I hope this helps you out!

      //Mikael

      "Mark" <LisaCook40@yah oo.com> wrote in message
      news:39c801c374 c2$c5458190$a60 1280a@phx.gbl.. .[color=blue]
      > I'd like to load xml contents to my dataset from an XML
      > document in memory. The dataset.ReadXML requires a file
      > on drive.
      >
      > Is there a way to do this from xmldoc in memory? Goal is
      > to use data source to bind xmldoc to datagrid control.[/color]


      Comment

      • Cowboy \(Gregory A Beamer\)

        #4
        Re: .NET dataset

        You can load it with a stream of any sort, which negates having to have a
        file to load it.

        --
        Gregory A. Beamer
        MPV; MCP: +I, SE, SD, DBA

        *************** *************** *************** *************** **********
        Think outside the box!
        *************** *************** *************** *************** **********
        "Mark" <LisaCook40@yah oo.com> wrote in message
        news:39c801c374 c2$c5458190$a60 1280a@phx.gbl.. .[color=blue]
        > I'd like to load xml contents to my dataset from an XML
        > document in memory. The dataset.ReadXML requires a file
        > on drive.
        >
        > Is there a way to do this from xmldoc in memory? Goal is
        > to use data source to bind xmldoc to datagrid control.[/color]


        Comment

        • Cowboy \(Gregory A Beamer\)

          #5
          Re: .NET dataset

          You can load it with a stream of any sort, which negates having to have a
          file to load it.

          --
          Gregory A. Beamer
          MPV; MCP: +I, SE, SD, DBA

          *************** *************** *************** *************** **********
          Think outside the box!
          *************** *************** *************** *************** **********
          "Mark" <LisaCook40@yah oo.com> wrote in message
          news:39c801c374 c2$c5458190$a60 1280a@phx.gbl.. .[color=blue]
          > I'd like to load xml contents to my dataset from an XML
          > document in memory. The dataset.ReadXML requires a file
          > on drive.
          >
          > Is there a way to do this from xmldoc in memory? Goal is
          > to use data source to bind xmldoc to datagrid control.[/color]


          Comment

          Working...