Component class - Get generated DataAdapters dynamically?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Q29uY2VwdG9y?=

    #1

    Component class - Get generated DataAdapters dynamically?

    Hi all,

    I created a new "Component Class" in a project (Add new... & choose
    "Component Class"). When you get into Design Mode you see the message: "To
    add components to your class, drag them from the Server Explorer...". If you
    drag a table from a data source in the Server Explorer, the designer
    generates a DataAdapter for the table, complete with the command objects
    filled with the correct SQL code.

    I need to know if there is a way to generate the exact same Data Adapter
    programmaticall y at runtime using a custom database connection and a table
    name.

    Something like:
    Dim x as new System.Componen tModel.Componen t
    Dim a as SQLDataAdapter = x.GenerateAdapt er(c as SQLConnection, tableName as
    string)
    ....even thought this code is invalid.

    I need to dynamically generate a DataAdapter on the fly, complete with its
    command objects, for a given database table known at run-time only. I
    thought of using the designer objects instead of dynamically generating the
    code myself.

    It would really save me some time would that be possible.

    Thanks,

    C
Working...