title: C# insert data into SQL table
body: <p>I m getting sqlException was unhandled. Incorrect syntax near 'nvarchar' and Incorrect syntax near 'Name'. I used SMO to create a table like this</p>
  
  <pre><code>Table TechOpsProjectTracker = new Table(db, "TechOpsProjectTracker");
  
  //Add column ID
  DataType dt = new DataType(SqlDataType.Int);
  Column idColumn = new Column(TechOpsProjectTracker, "ID", dt);
  TechOpsProjectTracker.Columns.Add(idColumn);
  
  //Add Column Alignment
  DataType dt1 = new DataType(SqlDataType.NVarChar, 50);
  Column Column1 = new Column(TechOpsProjectTracker, "Alignment", dt1);
  TechOpsProjectTracker.Columns.Add(Column1);
  
  //Add Column Project Name
  DataType dt2 = new DataType(SqlDataType.NVarChar, 50);
  Column Column2 = new Column(TechOpsProjectTracker, "Project Name", dt2);
  TechOpsProjectTracker.Columns.Add(Column2);
  
  //Add Column Project Description
  DataType dt3 = new DataType(SqlDataType.NVarChar, 255);
  Column Column3 = new Column(TechOpsProjectTracker, "Project Description", dt3);
  TechOpsProjectTracker.Columns.Add(Column3);
  
  //Add Column Currently Assigned To
  DataType dt4 = new DataType(SqlDataType.NVarChar, 50);
  Column Column4 = new Column(TechOpsProjectTracker, "Currently Assigned To", dt4);
  TechOpsProjectTracker.Columns.Add(Column4);
  TechOpsProjectTracker.Create();
  
  string connectionString = "Server=GSOPS4;Database=MyDatabaseName;Trusted_Connection=True;";
  
  System.Data.SqlClient.SqlConnection sqlConnection1 = 
    new System.Data.SqlClient.SqlConnection(connectionString);
  
  System.Data.SqlClient.SqlCommand cmd = 
    new System.Data.SqlClient.SqlCommand();
  cmd.CommandType = System.Data.CommandType.Text;
  cmd.CommandText = "INSERT TechOpsProjectTracker (ID, Alignment, Project Name, Project Description, Currently Assigned To ) VALUES (@ID, @Alignment, @Project Name, @Project Description, @Currently Assigned To)";
  
  SqlParameter ID = new SqlParameter("@ID", SqlDbType.Int);
  ID.Value = 5;
  cmd.Parameters.Add(ID);
  
  SqlParameter Alignment = new SqlParameter("@Alignment", SqlDbType.NVarChar, 50);
  Alignment.Value = "Right";
  cmd.Parameters.Add(Alignment);
  
  SqlParameter ProjectName = new SqlParameter("@Project Name", SqlDbType.NVarChar, 50);
  ProjectName.Value = "Right Project Name";
  cmd.Parameters.Add(ProjectName);
  
  SqlParameter ProjectDesc = new SqlParameter("@Project Description", SqlDbType.NVarChar, 255);
  ProjectDesc.Value = "Right Project Description";
  cmd.Parameters.Add(ProjectDesc);
  
  SqlParameter Assignment = new SqlParameter("@Alignment", SqlDbType.NVarChar, 50);
  Assignment.Value = "corp\\shress2";
  cmd.Parameters.Add(Assignment); 
  
  cmd.Connection = sqlConnection1;
  sqlConnection1.Open();
  cmd.ExecuteNonQuery();
  sqlConnection1.Close();
  </code></pre>
  
  <p>I get those exceptions at <code>cmd.ExecuteNonQuery();</code>
  Any reasons what might be causing it? TIA</p>