views:

159

answers:

2

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 *TableName*TableAdapter.GetData() and then *TableName*TableAdapter.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...

+2  A: 

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.

Payton Byrd
No, you're right a case statement would work, it's just that I would need 20+ since I have 20+ possible tables to work with and then if another table gets added means rebuild and deploy. I'm not clear on what you mean about what the data looks like and how that would affect invoking classes via reflection? Basically loading CSV file into a dataset merging it with the typed dataset and then updating it to the Db. I would like iterate through this routine based on table names which correspond with typed datasets.Thanks for the response...
lockh05
A: 

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

boomhauer