TableAdapter RRS feed

  • Question

  • Hi,

    I have a question regarding table adapters.  I have a table adapter with many queries and they all follow the same schema.  However, there are times I would like to only pull certain fields from the database but according to the documentation at Microsoft, this isn't allowed:

    In addition to the standard functionality of a DataAdapter, TableAdapters provide additional typed methods that encapsulate queries that share a common schema with the associated typed DataTable. In other words, you can have as many queries as you want on a TableAdapter as long as they return data that conforms to the same schema.

    I was wondering why this is?  Is there a way around this?  I like the whole idea of all my queries regarding to a certain table being stored under the table adapter for that database table.  I have close to 30 queries in the table adapter and would like to move some of these queries outside of the main schema to speed stuff up since the schema list all of the felids in the database table(which is needed sometimes).


    Tuesday, February 12, 2008 10:54 PM


  • Doesn't "follow the same schema" mean returning the same fields?  By design, the various queries for the TableAdapter all put the data in the same strongly-typed DataTable, so they must return the same fields.


    Consider writing your queries to return defaults / NULLs / etc. for the fields that do not apply.  Then, all of the queries will return data in the same format required by the DataTable to be populated.


    Code Snippet



    NULL AS FirstName,


    '1/1/1900' AS DateOfBirth





    Tuesday, February 12, 2008 11:57 PM