title: How to insert into SQL Server Compact database
body: <p>Updated question:</p>
  
  <p>For some reason, I got my code working (must have been a typo or something, still unsure). However, here's the final thing that puzzles me. I have this code:</p>
  
  <pre><code>string strConn = @"Data Source = |DataDirectory|\Database\DbFilm.sdf;Persist Security Info=False";
  
  string insQuery = "INSERT INTO film (naam, medium_id, genre_id, land_id, jaar, lengte, videoformaat_id) VALUES (@naam, @medium_id, @genre_id, @land_id, @jaar, @lengte, @videoformaat_id)";
  
  using (SqlCeConnection con = new SqlCeConnection(strConn))
  {
    con.Open();
      using (SqlCeCommand Query = new SqlCeCommand(insQuery, con))   
      {
       Query.Parameters.AddWithValue("@naam", dbNaam);
       Query.Parameters.AddWithValue("@medium_id", dbMedium_id);
       Query.Parameters.AddWithValue("@genre_id", dbGenre_id);
       Query.Parameters.AddWithValue("@land_id", dbLand_id);
       Query.Parameters.AddWithValue("@jaar", dbJaar);
       Query.Parameters.AddWithValue("@lengte", dbLengte);
       Query.Parameters.AddWithValue("@videoformaat_id", dbVideoformaat_id);
  
       Query.CommandType = System.Data.CommandType.Text;
       Query.ExecuteNonQuery();
       {
         con.Close();
       }
     }
  </code></pre>
  
  <p>This does not work. I don't get an error, but my database doesn't receive an insert. When I break at <code>ExecuteNonQuery</code>, I notice that the resulting query didn't get the proper values for the <code>@parameters</code>. So the actual query looks (in short) something like this:</p>
  
  <pre><code>INSERT INTO film (naam, medium_id) VALUES (@naam, @medium_id)
  </code></pre>
  
  <p>But it should be something like:</p>
  
  <pre><code>INSERT INTO film (naam, medium_id) VALUES ('title1', 'disc1')
  </code></pre>
  
  <p>What should I do to get the values from the strings (<code>dbNaam</code>, <code>dbMedium_id</code> and such) in place of <code>@naam</code>, <code>@medium_id</code> in my query?</p>
  
  <p>P.S. When I use this code with a query that does not use AddWithValue's, it works just fine.</p>