Add column in database using C#

Satyapriyanayak
Posted by Satyapriyanayak under C# category on | Points: 40 | Views : 923
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
str = "ALTER TABLE [dbo].[Test] ADD " + TextBox1.Text.ToString() + " Varchar(50) NULL ";
com = new SqlCommand(str,con);
com.ExecuteNonQuery();
con.Close();
}

Comments or Responses

Login to post response