Combine multiple sources into one dataset

Posted on 2005-05-17
Last Modified: 2012-05-05
I'm creating a sub routine that will be writing a flat, one row XML file to disk. No relations or parent/child stuff to worry about. There will be a number of different sources for values to be written - a couple different sprocs, as well as local values, Session and Request vars.

This is my first foray into the XML writer and I've reviewed a couple tutorials that are pointing me in the direction of using a DataSet as the source to output the XML from. My thinking at this point is that I'll build the Dataset from the various sources and then dump that to the xml writer.

Given that outline/overview of my intents I'd like to either be re-directed to a different stratagy or pointed to a tutorial or sample code that demonstrates the manual construction of a dataset from a variety of sources.

Question by:juststeve
    LVL 96

    Accepted Solution

    Start with some sample VB code:

        Dim ds As New DataSet

        Dim dt As New DataTable("Table")

        dt.Columns.Add(New DataColumn("Column1", GetType(String)))
        dt.Columns.Add(New DataColumn("Column2", GetType(Integer)))
        dt.Columns.Add(New DataColumn("Column3", GetType(Boolean)))



    Author Comment

    Ok...and inserting the values themselves looks to be as simple as:

        dt.Rows.Add(new Object() {Session("this_a_String"), dsDifferentOneFromSproc("ID"), TRUE)

    LVL 96

    Expert Comment

    by:Bob Learned
    Try this instead:

    Dim dr As DataRow = dt.NewRow

    dr("Column1") = Session("this_a_String")
    dr("Column2") = dsDifferentOneFromSproc("ID")
    dr("Column3") = True



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now