I have table abc
In taht I want to add colunm at run time. I have done some code but there is an error
SqlConnection cn = new SqlConnection() ;
cn.ConnectionString = "";
cn.Open();
SqlCommand cmd = new SqlCommand("alter table abc add" + textBox1.Text.ToString() + "varchar(500)",cn);
cmd.ExecuteNonQuery();
SqlCommand cm = new SqlCommand("insert into abc" + textBox2.Text.ToString() + "values(@a)");
cm.Parameters.AddWithValue("@a", textBox2.Text);
cm.ExecuteNonQuery();
cn.Close();
I have error in alter table : invalid column name textbox1.text.
and also How can i store data only in that column till last row in the table.