title: Having trouble with Sqlcompact Database in my Windows Form Application
body: <p>I have searched a lot regarding my problem but no solution so i am posting here to get advise from the experts.</p>
  
  <p>I am making a windows form application , and using Sql compact database.</p>
  
  <p>My Problem :</p>
  
  <p>When i am inserting records in the database using code (run time) they are inserted deleted , update and i can see them updated,inserted,deleted in my application , but when i close the application and start again only a few times they are changed, once a million :). Else i again see blank database ,or if i directly put values in the database from the solution explorer Visual studio 2010 , they stay there forever. I am using simple update,insert ,delete statement but not sure why the changes made to database disappear when i close the application.</p>
  
  <p>First this For all :</p>
  
  <pre><code>   Dim con As New SqlCeConnection
     Dim command As New SqlCeCommand
  
     connectionString = "Data Source=SqlCompactDatabase/RestaurantDatabase.sdf"
      con.ConnectionString = connectionString
  
      command.Connection = con
      con.Open()
  </code></pre>
  
  <p>My Insert Code :</p>
  
  <pre><code>            command.CommandText = "Insert into Inventory(itemcode,itemmin,itemmax,itemdesc) Values('" + itmcod + "','" + min + "','" + max + "','" + desc + "')"
              command.ExecuteScalar()
  </code></pre>
  
  <p>My Update Code:</p>
  
  <pre><code>    command.CommandText = "update Inventory set itemMin='" + min + "',itemMax='" + max + "',instock='" + stock + "',itemDesc='" + desc + "' where itemcode='" + TextBox1.Text + "'"
      command.ExecuteScalar()
  </code></pre>
  
  <p>My Delete Code:</p>
  
  <pre><code>      command.CommandText = "delete from inventory where itemcode='" + TextBox1.Text + "'"
      command.ExecuteScalar()
  </code></pre>
  
  <hr>
  
  <p>I open close connection correctly there is no error, there is something i can't figure out :)</p>