Hi,

Can anybody give an example of adding columns to an already populated dataset/datatable and reflecting changes to an already populated datagridview so that I can modify/added the row and use dataadapter.update to change the datasource.

Thanks
snky

Comments

You need to change the DataAdapter's update, delete, insert, and select queries and add another parameter for the new field. This is probably not a good idea.

Let me ask you this -- are you using a typed dataset or one created in code?

I use created in code, in memory.

Update/Delete working fine, because I don't have to add any column or so on those. Whereas I have to add number of columns to the already populated datatable and insert them all as new (RowStateAdded). It inserts only the ones which have already been populated. My ─▒nsert statement includes the newly defined columns. Apparently I fail to define new columns and attach them somehow to datatable. I have tried many possibilities but no result
thanks,

I think I solved it, it is uppercase/lowercase problem. When I define the new columns I defined them lowercase whereas in insertcommand they are uppercase. So newly added columns also inserted into datasource.

Those concepts however did not settle very clear in my mind

1- when I adapter.Update the datasource fields have to be uppercase, otherwise it does not work. Is there a parameter I have to define so that it accepts anything(upper or lowercase)

2- how do I reflect changes to datagridview after I add columns and enter values into them

3- If I enter values to the grid where those additional columns already defined in the formDesigner but not in the datatable, how can I reflect datagirdview to datatable

4- how should I use binding, beginedit and endedit in these cases
thanks,
snky

This article has been dead for over six months. Start a new discussion instead.