"Cannot change DataType of a column once it has data" error in Visual Studio 2005 DataSet Designer
I get the same error but only for columns with its DefaultValue
set to any value (except the default <DBNull>
). So the way I got around this issue was:
- Column DefaultValue : Type in
<DBNull>
- Save and reopen the dataset
Since filled Datatables do not entertain a change in the schema a workaround can be applied as follows:
Make a new datatable
Use datatable's Clone method to create the datatable with the same structure and make changes to that column
In the end use datatable's ImportRow method to populate it with data.
HTH
I have found a work around. If I delete the data column and add it back with the different data type, then it will work.