way to avoid re-configuring all adapters in a project after adding field to table?

Discussion in 'ASP .Net' started by Bennett Haselton, Oct 21, 2004.

  1. It seems whenever I add a new field to a database table that's queried
    by DataAdapters in my project, I get run-time errors because I don't
    go back and re-generate all the DataAdapters to read the new field.

    When I first generate the DataAdapter using the wizard, the list of
    fields in the database table gets hard-coded into the SelectCommand:

    SELECT ID, username, password_hash, email_address, datetime_created
    FROM wbuser

    and if I use that adapter to auto-generate a typed DataSet, that list
    of fields will be entered into the typed DataSet as well as the
    "wbuser" DataTable object. The problem occurs when I add another
    field to a database table, and then on some other WebForm I create a
    new DataAdapter for the "wbuser" table, and use it to re-generate the
    "wbuser" DataTable in the typed DataSet. Now, that wbuser DataTable
    in the typed DataSet is incompatible with all the old adapters that
    used the old list of fields. If the newly added field in the table
    doesn't allow nulls, for example, then if I try to use the old adapter
    to fill the new DataTable, I'll get a run-time error, presumably
    because it doesn't know what to put in the missing field.

    So is there some magic way to make all the DataAdapters re-configure
    themselves at once when I add a new field to a table?

    -Bennett
    Bennett Haselton, Oct 21, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel
    Replies:
    0
    Views:
    395
    darrel
    Jan 30, 2007
  2. Replies:
    0
    Views:
    428
  3. Max2006
    Replies:
    4
    Views:
    457
    Max2006
    Jul 17, 2007
  4. Max2006
    Replies:
    6
    Views:
    498
    Steven Cheng[MSFT]
    Aug 22, 2007
  5. dgk
    Replies:
    4
    Views:
    650
Loading...

Share This Page