CodenameCain
CodenameCain

Reputation: 573

Fill Multiple Tables in Single Typed Dataset?

Background

I am new to working with Datasets. I am finding examples, reading how-tos, watching tutorials, trying things to break down information and build it back up again to gain an understanding. I have the following:

GPDataSetTableAdapters.VPF_WORKTableAdapter adapt_VPF_WORK = new GPDataSetTableAdapters.VPF_WORKTableAdapter();
GPDataSetTableAdapters.VPF_Exhibitor_MSTRTableAdapter adapt_VPF_Exhibitor = new GPDataSetTableAdapters.VPF_Exhibitor_MSTRTableAdapter();
GPDataSet ds1 = new GPDataSet();
GPDataSet ds2 = new GPDataSet();

adapt_VPF_WORK.Fill(ds1.VPF_WORK);
adapt_VPF_Exhibitor.Fill(ds2.VPF_Exhibitor_MSTR);

Question

My question comes from noticing that each dataset variable shows me the other tables in the dataset:

ds1.VPF_Exhibitor_MSTR

...but the dataset was filled with a table adapter specific to one table. So is there a way to use a table adapter from the typed dataset to fill every table so that I am free to eliminate the need for the ds2 variable and use only ds1 with every table in my dataset?

Upvotes: 1

Views: 413

Answers (1)

D Stanley
D Stanley

Reputation: 152644

Sure - just use the same dataset reference in each Fill:

GPDataSetTableAdapters.VPF_WORKTableAdapter adapt_VPF_WORK = new GPDataSetTableAdapters.VPF_WORKTableAdapter();
GPDataSetTableAdapters.VPF_Exhibitor_MSTRTableAdapter adapt_VPF_Exhibitor = new GPDataSetTableAdapters.VPF_Exhibitor_MSTRTableAdapter();
GPDataSet ds1 = new GPDataSet();
//GPDataSet ds2 = new GPDataSet();

adapt_VPF_WORK.Fill(ds1.VPF_WORK);
adapt_VPF_Exhibitor.Fill(ds1.VPF_Exhibitor_MSTR);   // <-- change ds2 to ds1

Upvotes: 1

Related Questions