user283719
user283719

Reputation:

Iterating strongly typed DataSets

I basically need to be able to iterate through tables to extract, transform and load data into typed datasets. Based on the table name from a list I need to construct the TableNameTableAdapter.GetData() and then TableNameTableAdapter.Update(). The only thing I can think of (beside writing this code for each table) is using reflection, but hoping somebody else has a suggestion.

Much appreciated...

Upvotes: 1

Views: 637

Answers (2)

Brady Moritz
Brady Moritz

Reputation: 8903

You can also access the untyped dataset underneath the typed one. Not sure if this helps you or not in this situation though.

Upvotes: 0

Payton Byrd
Payton Byrd

Reputation: 986

You are going to have to use reflection no matter what because invoking the correct TableAdapter is going to require loading the class with reflection so you can invoke the GetData method with reflection.

This all kind of defeats the purpose of TypedDataSets. Is there a reason where a case statement would not be appropriate? You also haven't given us a good clue as to what the actual data you want to enumerate looks like so it's hard to even give an answer on how to enumerate the data and invoke with reflection.

Upvotes: 2

Related Questions