I want to create a function which take a TablAdapter as parameter and return
a typed DataTable. Like:
DataTable GetDataTable(TableAdapter adp)
{
.....
}
But I find there is no parent class for specific TableAdapter.
How can I finish this function?
Miha Markic [MVP C#] - 22 Apr 2006 19:51 GMT
It is a Component derived class. The only way I see it is to pass a
Component and use reflection.

Signature
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>I want to create a function which take a TablAdapter as parameter and
>return a typed DataTable. Like:
[quoted text clipped - 7 lines]
>
> How can I finish this function?
JohnMSyrasoft - 22 Apr 2006 19:59 GMT
Can you be more specific on what you're trying to do?
TableAdapters are defined against a strongly-typed dataTable and the queries
contained in a TableAdapter must match the schema of the typed DataTable. I
don't think there is a way to generically pass a TableAdapter as a parameter.
Like DataAdapter, TableAdapter has both Fill and GetData methods builtin.
For TableAdapters, GetData returns a new strongly-typed datatable.
MyTypedDataSetTableAdapters.Table1TableAdapter adp;
MyTypedDataSet.Table1DataTable tbl = adp.GetData();
There isn't a 'parent' or generic tableAdapter class that specific
TableAdapters inherit from. Since a TableAdapter is like having a collection
of predefined parameterized queries that match a specifc table schema, I'm
trying to determine why you would want to pass it as a parameter to a
function that can only return a strongly-typed table.
> I want to create a function which take a TablAdapter as parameter and return
> a typed DataTable. Like:
[quoted text clipped - 7 lines]
>
> How can I finish this function?