Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining two results of datasets into one

I have created a webservice which returns two datasets(return type) as results. Is it possible to combine two datasets results into one so that I can display it on one datalist? I try using arraylist but it returns nothing in datalist.

GetDepartureFlightsDetails() and getDepartureFlights() both returns a dataset values.

Below is the method i use to retrieve the webservice results.

public ArrayList GetDepartureFlightsDetails(String departurecountry, String arrivalcountry, DateTime departuredate)   
{
    DLSA datalayerTS = new DLSA();
    DLJS datalayerJW = new DLJS();

    ArrayList array = new ArrayList();

    array.Add(datalayerSA.GetDepartureFlightsDetails(departurecountry, arrivalcountry, departuredate));
    array.Add(datalayerJW.getDepartureFlights(departurecountry, arrivalcountry, departuredate));
    return array;
}
like image 693
FredHomme Avatar asked Jan 02 '13 06:01

FredHomme


1 Answers

You can use the DataSet.Merge method:

firstDataSet.Merge(secondDataSet);

Update:

public DataSet GetDepartureFlightsDetails(String departurecountry, String arrivalcountry, DateTime departuredate)
{
    DLSA datalayerTS = new DLSA();
    DLJS datalayerJW = new DLJS();

    var firstDataSet = datalayerSA.GetDepartureFlightsDetails(departurecountry, arrivalcountry, departuredate));
    var secondDataSet = datalayerJW.getDepartureFlights(departurecountry, arrivalcountry, departuredate));
    firstDataSet.Merge(secondDataSet);

    return firstDataSet;
}
like image 72
Eren Ersönmez Avatar answered Oct 29 '22 15:10

Eren Ersönmez