Add Queries to TableAdapters in code rather than through designer

Overcome the issue of Designer Queries being brittle and being deleted on DataSet changes…

One issue with using Visual Studio designer view for manipulating TableAdapters is that it is very brittle. If you ever delete your tables or change them in your database and update, you loose any custom queries you have made. The below illustrates a way to construct new queries for each TableAdapter in code and thus ensure you do not loose these.

Simply construct a new class and then use the example code below to hard code your queries:

And usage:

Gi_gameTableAdapter.FillByWhere(dbDS.gi_game, "`SystemID` = '" & SysIDString & "'")
About stigzler 48 Articles
Chief crook and wattle bosher.

Be the first to comment

Leave a Reply

Your email address will not be published.


*