Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strongly typed datasets and schema changes

I have a project which uses strongly typed datasets.

Let's assume I want to change the database schema of the database used by this application. I have a table named Country and I want to add a new column named "IsADemocracy" (that's an example) of the SQL Server datatype BIT.

Now, how do I update the strongly typed dataset so that I can use this new field in the application?

I've tried adding the column in the Country table on the dataset, gave it the type of boolean and mapped its "Source" property to "IsADemocracy".

I can access the field in the application, give it a value, etc, but the underlying queries made by the table adapter have not been updated to reflect this change. They are as they were before I added this column in the strongly typed dataset. I hoped what I did would be enough but it does not seem to be the case.

Should I regenerate the strongly datasets classes somehow? If so, how and what are the implications?

I could probably delete the Country table in the Dataset designer, and redrop it from the Server Explorer, but I have customer queries on it and I don't want to lose them.

Thanks.

like image 213
Kharlos Dominguez Avatar asked Aug 04 '10 17:08

Kharlos Dominguez


1 Answers

Another suggestion - right click on the Table's representation in the designer i.e the xsd, and use the Add Option, to add a Column. Once you have the column, you need to set its properties as by default a new column gets added as a string. Doing it this way means you retain any custom queries etc that have been added earlier.

This allows you to add columns, obviously deleting is more straightforward.

like image 52
Mickey Puri Avatar answered Oct 12 '22 01:10

Mickey Puri