Visual Studio DataSet Designer Refresh Tables
Asked Answered
B

6

8

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?

Blacken answered 16/4, 2010 at 12:8 Comment(0)
A
9

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.

Apollo answered 7/5, 2010 at 5:53 Comment(2)
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.Blacken
"uses it to schema your table" doesn't quite make sense. (The schema is more than a list of columns.) Dealing with a column with a revised length, no amount of "refresh" on the DataSet, the table in question or the column in the table seem to communicate with the xsd. I was able to expand the DataTable object, select the column, and edit is MaxLength property in the properties list. (But it leaves the question of why "refresh" isn't refreshing unanswered. Now with VS2012, but I'm sure I had this same issue with VS2008.)Mammillary
T
2

I reported this to MSFT but no response. The designer hangs all the time on the simplest of SQL statements. What I found that works for me is.

  1. Add a new table to the designer.
  2. Save it.
  3. Shut down visual studio 2010.
  4. Start VS 2010.
  5. Add one or two more SQL statements and follow steps 2-4 again.

This is a pain in the neck but the only thing that stops Visual Studio dataset designer from hanging. I experienced in this same issue in VS 2008. I am connecting to Oracle but still shutting down VS and starting it back up works, but really, this is nonsense.

Troostite answered 4/1, 2011 at 14:34 Comment(1)
It's 2021 and this problem persists in Visual Studio 2019. I think they terminated development in this area long ago =(Coon
D
0

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

Deel answered 22/4, 2010 at 15:6 Comment(0)
B
0

You should be able to right-click the dataset in solution explorer and select "Run Custom Tool" to refresh the table and it's query/relationships.

If that command is not there, check that the dataset properties has "MSDataSetGenerator" in the Custom Tool field.

Bonar answered 3/12, 2010 at 15:47 Comment(0)
D
0
  1. Right click on your DataSet name and select Dataset Properties
  2. Below the Query box you will see a button for Refresh Fields.
  3. Click on Query Designer and the new field should show in your table list.
Dodder answered 3/9, 2015 at 14:59 Comment(0)
W
0

Right Click the .xsd file from Visual Studio Solution Explorer

Go into the .xsd file’s Properties

Set the "Build Action" to "Content"

Update the "Custom Tool" property to "MSDataSetGenerator". You need to write it in the Text Box Provided.

enter image description here

Wherefore answered 14/3, 2023 at 13:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.