Results 1 to 4 of 4

Thread: [2008] How do I populate a Strongly Typed DataSet with XML

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Manchester, England
    Posts
    255

    Question [2008] How do I populate a Strongly Typed DataSet with XML

    I am trying to populate a table in a strongly typed dataset used for the ReportViewer.
    I want to read in an XML file which was created manually using ds.WriteXML.
    The strongly typed dataset has been created to match the structure of the XML file written with ds.WriteXML.
    How do I read in the XML file, and populate the table within the dataset used for the ReportViewer?
    At home - VB.NET 2005/2008 Express, Visual Web Developer 2005 Express
    At work - VS 2008 Standard (VB)
    .NET 2.0/3.5


    Visual Studio Express Learning Centre | How do I videos | MSDN VB Express Forum | MSDN VB Developer Centre

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] How do I populate a Strongly Typed DataSet with XML

    If the WriteXml method was used to write the XML, what method do you suppose would be used to read the XML?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Manchester, England
    Posts
    255

    Re: [2008] How do I populate a Strongly Typed DataSet with XML

    No, you misunderstood.
    I AM using ReadXML, but I only seem able to read the XML into a NEW dataset ... I'm just struggling to pass what I've read to the strongly typed dataset.
    I can't, for example, use StronglyTypedDataSet.ReadXML(filename).
    As a workaround, I've forced the code to dump the designed report bindings in favour of my programmed bindings.
    At home - VB.NET 2005/2008 Express, Visual Web Developer 2005 Express
    At work - VS 2008 Standard (VB)
    .NET 2.0/3.5


    Visual Studio Express Learning Centre | How do I videos | MSDN VB Express Forum | MSDN VB Developer Centre

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] How do I populate a Strongly Typed DataSet with XML

    Really? What happens when you try? I'd have thought that as long as the schemas matched it would be fine. That said, I haven't tested that. Maybe ReadXml tries to discard the existing schema and create a new, although I'd have thought you could control that. Have you read the documentation for the method to see? If you can't then I guess you would have to use two steps. Read the data in first and then populate the DataSet manually. For the first step you could use an XmlReader, an untyped DataSet or an XmlDataDocument.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width