santhosh_cz

hi all,

Is it possible to add a column in the DATABASE using .net. I am using sql server database 2003 and .net 2.0... if i add a column to the webgrid,then in my database also the column should be added..is it possible if so how can i do this



Re: .NET Framework Data Access and Storage Dynmically adding a column to a database using .net

Mark The Archer Evans

best create a class that represents your sqlserver. then you can add methods to it for adding columns (by firing the sql at the database with the necessary details) or any other fields you want. Also means that you seperate out your data logic from your buisness layer. Your method should only require two parameters ie. public function AddColumn(byval tableName as string, byval columnName as string) as boolean.

Use the alter table sql to add your column...

hope this helps...