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

B

Bennett Haselton

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top