Adding new column in exist table
I am working on visual studio 2010 Professional, i have table and i want to add new column and name the the column by get it from a form that contain texttbox, then i enter column name and then click on add button and then i would have a new column added to my exist table
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kunal VaishyaRank #990 · 2K reputationPosted May 28, 2012, 5:11 AM EDT
Alter Table TableName Add FldName FieldType
Example
Alter Table Company Add ComapnyAddress VarChar(50)
younis abdeljawwad67 reputationPosted May 28, 2012, 6:20 AM EDT
Kunal VaishyaRank #990 · 2K reputationPosted May 28, 2012, 9:07 AM EDT
sCon = "Connection String";
System.Data.SqlClient.SqlConnection cn = new System.Data.SqlClient.SqlConnection (sCon);
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = " Alter Table Company Add ComapnyAddress VarChar(50) ";
cmd.Connection = cn;
cn.Open();
cmd.ExecuteNonQuery();