title: Why isn't my SQL query to insert a table row working properly?
body: <p>I am fairly new to C# and SQL, so this may be a very easy question to answer.</p>
  
  <p>I am trying to add a row to a table (<code>EventList</code>) through C# code.  I have opened my <code>SqlConnection</code> without any issues, and I know I am connected to the correct database as some earlier code is querying for rows in one of the tables and it's returning the correct keys.</p>
  
  <p>The SQL query to insert the row into the table is like this:</p>
  
  <pre><code>sqlCmd.CommandText =
      "insert into EventList values ('" +
      eventListIdentifier + "','" +
      eventId.ToString() + "')";
  sqlCmd.ExecuteNonQuery();
  </code></pre>
  
  <p>I am using SQL Server Management Studio Express to view the tables in my database.  After running the above query, I right-click on the <code>EventList</code> table and click <code>Open Table</code>.</p>
  
  <p>I am not seeing the new row added based on the above call.  Any ideas what I may be doing wrong?</p>
  
  <p><b>Update 1</b></p>
  
  <p>The data types I'm inserting are:</p>
  
  <pre><code>eventListIdentifier (varchar(100), null)
  eventId (varchar(8000), null)
  </code></pre>
  
  <p>I manually created the same query in SSMS like this:</p>
  
  <pre><code>insert into EventList(eventListIdentifier, eventId ) values('test', 'blah')
  </code></pre>
  
  <p>and says the following:</p>
  
  <pre><code>(1 row(s) affected)
  </code></pre>
  
  <p>However no row has been added to the table when I right-click on it and open it.</p>
  
  <p><b>Update 2</b></p>
  
  <p>Output of <code>System.Console.WriteLine(sqlCmd.CommandText);</code> as requested by @billinkc:</p>
  
  <pre><code>insert into EventList(eventListIdentifier, eventId) values ('7/09/2011 10:43:55 AM','7')
  </code></pre>