title: Data insertion obviously works, but is not showing up on table
body: <p>I am trying to insert data into my database table using the insert statement as shown below:</p>
  
  <pre><code>private void buttonPurchase_Click(object sender, EventArgs e)
  {
  if (MessageBox.Show("Purchase?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
  
      ////store invoice
      string connectionString = ConfigurationManager.ConnectionStrings
      ["CarDBConnectionString"].ConnectionString;
      SqlConnection sqlConnection1 = new SqlConnection(connectionString);
      System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
      cmd.CommandType = System.Data.CommandType.Text;
      cmd.CommandText = "INSERT INTO [dbo].[invoiceTbl] ([invoiceId], [dateAndTime]) VALUES (2, N'2014-06-22 00:00:00')";
      cmd.Connection = sqlConnection1;
      sqlConnection1.Open();
      cmd.ExecuteNonQuery();
      sqlConnection1.Close();
  }
  </code></pre>
  
  <p>but although no errors were shown, the code works, the data inserted is not showing up in my table data. I tried adding them manually in the table, and copied the sql statement directly into the code shown above, when I add in duplicate data it is detected, but when I add in data again (without duplicating the primary key) the table data shows NULL and NULL respectively. So in short I think my code works, but for some weird reason it just doesn't show up in my schema! Any help is deeply appreciated! :)</p>