I am adding columns to a DataTable like so:
DataColumn newColumn = new DataColumn("NEW_COLUMN", typeof(bool));
newColumn.DefaultValue = false;
newColumn.AllowDBNull = false;
According to what I see in my UI, this works just fine. The DataGridView that I have bound to my DataTable Table gets updated with a new column as expected.
Later, I update the DataSource thusly:
adapter is an SqlDataAdapter.
When I close my application then look at my DataTable again, the columns that I added are not there. Likewise, any columns that I removed are still there.
The only changes that persist are the addition and deletion of rows, and the changing of data in any cells of columns that were neither added nor deleted.
I suspect that the adding of columns is strictly an ALTER operation, not an INSERT, DELETE, or UPDATE operation, and I'm trying to find out how I can add ALTER functionality to my adapter.
Or maybe I'm on the wrong track entirely.
Any suggestions, out there?