hello there
i want to create a 2 column in an existing table of my database using C# i mean in my window form 2 textbox and one button is there
i enter some text and click on the button
then i creates a column named as i write in textbox
my database is sql server database .mdf file
help me out please
Loading

Amit Kumar SinghRank #562 · 4.3K reputationPosted Feb 25, 2016, 9:02 PM EST
using (DbConnection connection = new SqlConnection("Your connection string")) { connection.Open(); using (DbCommand command = new SqlCommand("alter table [Product] add [ProductId] int default 0 NOT NULL")) { command.Connection = connection; command.ExecuteNonQuery(); } }Raja TRank #685 · 3.5K reputationPosted Feb 25, 2016, 9:28 PM EST
Krishna Rajput SinghRank #605 · 4K reputationPosted Feb 25, 2016, 11:27 PM EST