im trying to create a table with the name of a dynamically retrieved value
here is the code
string nok="";
while (reader.Read())
{
noo = reader.GetInt32(3);
nok = noo.ToString();
MessageBox.Show(noo.ToString());
}
con.Close();
var commandStr = "If not exists (select name from sysobjects where name = C"+nok+") CREATE TABLE C"+nok+"(A char(50),B char(50),C char(50),D char(50),E char(50),F char(50),G char(50),H char(50),I char(50),J char(50),K char(50),L char(50),M char(50),N char(50),O char(50))";
MessageBox.Show(commandStr);
con.Open();
using (SqlCommand command = new SqlCommand(commandStr, con))
command.ExecuteNonQuery();
but im getting an error invalid column name with that dynamic value
name = C3should at least be enclosed in quotes (iename = 'C3').