I have a gridview that the columns are auto generated because I can add and remove columns in runtime from the database table, in that way I never know the name of the column.
My problem is this, If I want to update a value in that especific columns that I added in runtime, how can I do this, because I don't know the name of that columns, I can't figure out...
As far as I see,I think you can use SqlDataAdapter.Fill method to DataTable, and then use SqlCommandBuilder to generate CRUD methods,and then you can do modifications to DataTable,and then call SqlDataAdapter.Update to upgrate the DataTable to the real table.
Reguards!
Marked as answer by furapt on Aug 12, 2012 08:24 PM
furapt
Member
16 Points
18 Posts
Dynamic SQL data source
Aug 10, 2012 10:42 PM|LINK
Hi all,
I have a gridview that the columns are auto generated because I can add and remove columns in runtime from the database table, in that way I never know the name of the column.
My problem is this, If I want to update a value in that especific columns that I added in runtime, how can I do this, because I don't know the name of that columns, I can't figure out...
Any ideas...
Thank you
My web app is in c# and asp.net
sql sqldatasource
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Dynamic SQL data source
Aug 12, 2012 01:21 AM|LINK
Hi,
As far as I see,I think you can use SqlDataAdapter.Fill method to DataTable, and then use SqlCommandBuilder to generate CRUD methods,and then you can do modifications to DataTable,and then call SqlDataAdapter.Update to upgrate the DataTable to the real table.
Reguards!
furapt
Member
16 Points
18 Posts
Re: Dynamic SQL data source
Aug 12, 2012 08:24 PM|LINK
Hi,
Yes, that is an alternative but I will change the approach of the app, thanks anyway!