Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update DataSet structure in Visual Studio to match new SQL Database Structure

After making some changes to my SQL database structure (using scripts in SQL Server Management Studio), how can I update my DataSet.xsd file in Visual Studio to match the new structure? Must I do this manually?
I considered deleting the DataSet and importing a new one, but I'll lose all my custom Table Adapter queries.

like image 459
MattyG Avatar asked Feb 29 '12 10:02

MattyG


People also ask

How do I set up and configure datasets in Visual Studio?

Open your project in Visual Studio, and then choose Project > Add New Data Source to start the Data Source Configuration Wizard. Choose the type of data source to which you'll be connecting. Choose the database or databases that will be the data source for your dataset.


1 Answers

From the MSDN Forums:

If you right-click the TableAdapter in the Dataset Designer and click 'Configure' the TableAdapter Configuration Wizard opens where you can reconfigure the main query that defines the schema of your table. This should leave the additional TableAdapter queries (the additional methods) that were added after initial configuration.

Of course the additional methods will also need to be reconfigured if they reference a column that has been removed from the table on the database, or if any of the column definitions change (for example, if the data type is changed or modified). So if an aditional column was added to the table and it allows Null values the existing methods should still work - just depends on the scope of change to the schema of the table in the database.

like image 196
Steve Avatar answered Oct 13 '22 22:10

Steve