Wednesday, July 16, 2008

How to update or refresh a Typed DataSet (xsd file) in the DataSet Designer in Visual Studio

I had this issue and had a mental fart and couldn't figure how to solve it.  I read some message boards where people said it was impossible, but the solution is simple.  If you have a typed dataset in the DataSet Designer and you make changes to the database in sql server (just say add a new column), you can refresh the Dataset by clicking on the Data Sources tab.  Then right click on your dataset or table and clicking "refresh'.

In my situation, my dataset was populated by a stored procedure.  So I had to go into Microsoft Sql Server Management Studio Express, Go the Programmability Folder/Stored Procedures and find my stored procedure.  right click it and select modify, then add the new column and execute it.

Then back in Visual Studio, I had to right click on my Dataset Table and select "Configure Dataset with Wizard" and expand the Stored Procedures, then find my stored procedure and at the bottom was the new column that I added.  Just check the column name and it was added to the dataset.

the above paragraph would probably also apply even if you didn't have a Stored Procedure by your main engine, as you could add and remove tables using the "Configure Dataset with Wizard".

-- Ted


1 comment:

Unknown said...

Thank you. I too had a 'brain fart' and couldn't for the life of me work out how to do it.

It was more frustrating as I'd done it a few days before - I simply couldn't remember how!

So, thank you! ;-)