Solved

ASP.net merge two datasets

Posted on 2014-02-18
2
265 Views
Last Modified: 2014-02-24
Hi

What is the easiest way to merge two datasets that have the same first two columns, and that are created using code like the following


    Function GetData(ByVal queryString As String) As DataSet

        Dim cs As String = ConfigurationManager.ConnectionStrings("survey_conn").ConnectionString
        Dim myConnection As SqlConnection = New SqlConnection(cs)

        Dim ds As New DataSet()

        Try

            ' Connect to the database and run the query.

            Dim adapter As New SqlDataAdapter(queryString, myConnection)
            ' Fill the DataSet.
            Adapter.Fill(ds)


        Catch ex As Exception

            ' The connection failed. Display an error message.
            Me.Label_Error1.Text = "Unable to connect to the database." & Err.Description

        End Try

        Return ds

    End Function
0
Comment
Question by:murbro
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
Comment Utility
Easiest way should be DataSet.Merge.

DataSet.Merge Method
http://msdn.microsoft.com/en-us/library/system.data.dataset.merge(v=vs.110).aspx
0
 

Author Closing Comment

by:murbro
Comment Utility
Thanks very much
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

13 Experts available now in Live!

Get 1:1 Help Now