Database changes not shown in dataset.xsd correctly

muro

Active member
Joined
Apr 30, 2018
Messages
26
Programming Experience
3-5
Dear friends,

when i change things in my sql database, for example i add a new column, delete one, change datatype of a column and stuff like that and then update my dataset with the wizard the changes are not shown correctly. Some things are updated correctly some not and only if i delete the datatable from the dataset.xsd and add it again (with the datasource update wizard) it is shown correctly. The problem is i have added so many queries on my datatable in the dataset xsd , and then i need to write them all manualy again since they are also deleted with the table. so how to update the dataset.xsd and apply all new changes from database, correctly, so it matches the table in the database?

I tested entitiy framework and the changes from the db are shown correctly in the enitity model, but i dont want to use entitiy since there are alof of things i don´t know.
 
Your question is far too vague. It basically reads "I do something and it doesn't work, how do I fix it". One thing I can tell you is that anything you delete from the database will not be automatically deleted from the DataSet because the IDE doesn't want to delete something that you added manually and it can't distinguish the two. If you made lots of changes at the same time then maybe that caused some confusion but, with such a vague description, we can only speculate. Rerunning the wizard from the Data Sources window SHOULD update the DataSet correctly so that's all we can really direct you to do without a better description of what was actually done and what actually happened.

If you are making lots of changes then perhaps updating the DataSet in stages as you go might guard against issues like this but, again, that's only speculation. Maybe you could restore a backup so you're back to your old state and then try again in stages.
 
Thank you sir. It is just that the dataset.xsd doesn´t show the database correctly. new columns or new tables in the database are detected and added to the table in the dataset.xsd correctly, but not when i change the datatype of a column or for eaxmple when i change the nvchar(10) to nvchar(50). i have rebuild the project many times and used the update wizard of the datasource, nothing happening.

i guess the only way to solve this, is to delete the table from the dataset.xsd and run the update wizard again, then everything is fine and correct.
 
i guess the only way to solve this, is to delete the table from the dataset.xsd and run the update wizard again, then everything is fine and correct.

Or delete the column from the table and then run the wizard again. You just said that new columns are added correctly so that should just be treated as a new column. The alternative would be to simply change the data type in the DataSet yourself. Much less work than adding in multiple custom queries again.

As I said, the wizard won't remove deleted tables and columns automatically because it can't distinguish between what was added automatically and then deleted from the database and what you added manually. I'm guessing that changes in data type are treated the same way.
 
Back
Top Bottom