I want to add new field when user enter text in text box and click on create then in the database table new field is create with the name present in text box
I use this code to do this but it takes a8 as new field
can i use this line of code to do this but it give me error message that one or more argument cant use.
string q = ("alter table abc add'"+textbox1.text.tostring()+" varchar(20)"+"'",cn);
this is my code:
SqlConnection cn = new SqlConnection();
cn.ConnectionString = "Data Source=WELL\\SQLEXPRESS;Initial Catalog=master;Integrated Security=True";
cn.Open();
string s;
s = textBox1.Text;
string q = "alter table abc add a8 varchar(20)";
SqlCommand cmd = new SqlCommand(q, cn);
cmd.ExecuteReader();
//cmd.Parameters.Add(new SqlParameter(cmd, cn));
SqlDataReader dr = cmd.ExecuteReader();
cn.Close();