I have a rather unusual situation of which I would greatly appreciate some help on. Basically I have a typed ADO.Net Dataset that does not contain any data just a schema with relations and all. We can call this CurrentDataSet, it has about 56 tables in it..(I know right not very clever).
Anyway, I use this dataset to bind data to controls on a specific form with tabs. OK hope that is clear. Now I am getting the data from an API call which returns XML Data of which I then read and create a new Dataset from this using the below method:
Dim web As New WebClient()
Dim url As String = String.Format("https://test.co.uk/api/company?id=12345&apiKey=xxxx")
Dim response As String = web.DownloadString(url)
Dim ds As New DataSet()
Using stringReader As New StringReader(response)
ds = New DataSet
I then can get the datatables from this new Dataset using ds.Tables("TableName"). However what I would like to do is populate CurrentDataSet with the data that comes from ds, so that it would be easier for me to use the bindingsource from CurrentDataset to bind to my controls. I know you can use the importrow method to import rows into CurrentDataSet...but there is a major caveat.
The problem is that the returned datatables from the API call aren't always present if there is no information in them. The API only returns datatables and fields from the relevant datatables if there are rows or data in them.
CurrentDataSet contains all possible fields and tables that the API could possibly return, now I want to know how I can update CurrentDataSet with row items only where table and field names exist between ds and CurrentDataSet? Ideally if I could merge the new dataset(ds) into matching tables/field in one go rather than looping through each datatable and columns, that would be great
I am putting maxmimum points on this because I think it is really difficult, thanks in advance.