Matt
Matt

Reputation: 2815

DataAdapter.Fill to specific table in dataset

I am trying to make use of DataAdapter, unfortunately stuck with straight ADO.Net, and all of the examples I see have a call like this:

dataAdapter.Fill(dataSet, "TableName");

I want to do a fill in that manner, meaning the data goes into a named table, so that I can properly manage the tables later on in the cycle.

Unfortunately, it appears that that method signature no longer exists, and I am struggling a bit to figure out how to name the table in the DataSet properly. Is there a preferred method for doing this now? Or did MS just scrap this method of interacting with your DataSet?

Upvotes: 1

Views: 7733

Answers (1)

decyclone
decyclone

Reputation: 30840

How about something like this ?

    DataTable myTable = new DataTable("MyTable");
    adapter.Fill(myTable);
    ds.Tables.Add(myTable);

One more thing, the method signature you mentioned does exist. You can find the method reference here.

Upvotes: 2

Related Questions