I have an SQL table called tbl, im trying to add the columns A, B and C to it.
When i execute the command :
String addcolumns = "ALTER TABLE SqlCreatedTbl ADD A char(50) ;";
......
cmd = new SqlCommand(addcolumns, conn);
conn.Open();
cmd.ExecuteNonQuery();
The column is added !
However, when i try to add multiple columns, it does NOT work, it gives me an error.. the command im writting for adding multiple columns is the following:
addcolumns = "ALTER TABLE SqlCreatedTbl ADD ( A char(50), B char(50), C char(50) );";
the debugger highlights the line : cmd.ExecuteNonQuery();
and throws the following exception:
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near '('.