views:

508

answers:

2

In visual studio datasource designer is there any way to refresh a table and its relations/foreign key constraints while keeping the custom queries?

The way I am doing it at the moment is removing the table and adding it again. This adds all the relations and refreshes all fields.

Also if I change a fields data type, is there a way to automatically refresh all the fields in the datasource? Again without deleting the table and adding it again.

Reason for this is because some of my TableAdapters have quite a number of complex queries attached to them and when I remove the table the adapter gets removed as well including all its queries.

I am using Visual Studio 2008 and connecting to a MySQL database.

Any1 have an idea?

+1  A: 

You can add/change/remove fields and relation ships, but i would suggest looking into NHibernate.

SeeSharpCoder
A: 

Each table has a default query (The one on top with the check on it). When you dragged your tables in to the dataset to create the query, it wrote a SQL statement which it uses to schema your table. Keep that query simple, you might not actually use it in code, and you can always edit that query to update the table schema.

Every time you open the default query it connects to your datasource and allows you to select new columns that weren't in there before. If you want to update your existing columns, delete all the columns out of the table before you attempt to open the query. When you save the query, your updated columns get added back.

Make sure your connection string has permissions to view column information.

Carter
Thanks for that :) I have actually started using NHibernate as suggested above, but thanks anyway, this would of helped me before I started using NHibernate.
LnDCobra