for (int j1=0;j1<y;j1++) { con.Open(); using (SqlCommand command = new SqlCommand("alter table [empmaster] add [td['"+j1+"']] varchar(50) default 0 NOT NULL")) { command.Connection = con; command.ExecuteNonQuery(); } }
ALTER TABLE
alter table [empmaster] add td1 varchar(50) default 0 NOT NULL
using (SqlCommand command = new SqlCommand("alter table [empmaster] add td"+j1+" varchar(50) default 0 NOT NULL")) { ...
for (int j1=0;j1<y;j1++) { con.Open(); using (SqlCommand command = new SqlCommand("alter table [empmaster] add [td"+j1+"] varchar(50) default 0 NOT NULL")) { command.Connection = con; command.ExecuteNonQuery(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)