How to identify the tables in a dataAdapter?

  • Thread starter Thread starter Geoff Pennington
  • Start date Start date
G

Geoff Pennington

I have a class method that returns a DataAdapter. I want to access the
table(s) contained in the DataAdapter. Of course, accessing the DataSets
would be good enough, because I could get the tables from there. I can't
find a way to do this. Am I missing something?

Much obliged.
 
Hi Geoff,

Datasdapters don't have tables - they are device to pass data into a
dataset.

You can get the tables inside a dataset with
For Each tb In Me.Petailerds1.Tables

MessageBox.Show(tb.TableName)

Next

HTH,

Bernie Yaeger
 
Hi Bernie -
Sorry, that doesn't help. Looks like what I want to do can't be done.

I want to apply a bunch of insert/update/delete to a table and then use the
DataAdapter.Update method to apply the updates all at once. I have a
business class that should return the DataAdapter to the application; the
application will apply the updates to the table; then the application
returns the DataAdapter to another method in the business class, which calls
the DataAdapter.Update method. But apparently this just won't work, because
the returned DataAdapter has no idea what tables were "filled" into what
datasets. One solution would be to ditch the business class and do
everything in the application, but I'm trying to be more object oriented
than that.

But maybe it doesn't matter anyway. There are other reasons why the Update
method doesn't work so well for my app. Thanks for trying.

Geoff.
 
Same problem. If I am passing around a dataAdapter, how do I get to the
datasets? The DataAdapter does not actually have a dataset collection; so my
idea of passing around the DataAdapter and getting from it either then
tables or datasets just won't work. Apparently.
 
Hi Geoff,

You could create a globals class that has an array or arraylist in it.
Increment that array with the name of the dataset each time you use the
dataadapter fill method. Then, when you want to know the datasets filled by
that dataadapter, you have it in the array.

HTH,

Bernie
 
OK, that should work. Thanks.

Bernie Yaeger said:
Hi Geoff,

You could create a globals class that has an array or arraylist in it.
Increment that array with the name of the dataset each time you use the
dataadapter fill method. Then, when you want to know the datasets filled by
that dataadapter, you have it in the array.

HTH,

Bernie
 
Back
Top