title: C# - Writing data in local database
body: <p>Im working on a program to save Passwords.</p>
  
  <p>I want to write them in a local database file (Name: Database.sdf).</p>
  
  <p>This is my SQL query:</p>
  
  <pre><code>SqlCeConnection conn = new SqlCeConnection();
  conn.ConnectionString = "Data Source = Database1.sdf";
  conn.Open();
  SqlCeCommand cmd = new SqlCeCommand("INSERT INTO Passwords (Nr, Username, Password, Email, Website, Description, Rating, DateTime) VALUES ('" + UsernameBox.Text + "', " + PasswordBox.Text + "', '" + EmailBox.Text + "', '" + WebsiteBox.Text + "', '" + DescriptionBox.Text + "'," + RatingValue.Value + "," + DateTime.Now + ")", conn);
  
  conn.Close();
  </code></pre>
  
  <p>But somehow it doesnt work.
  This is my database setup:
  <a href="http://imgur.com/0JxX79y" rel="nofollow">http://imgur.com/0JxX79y</a></p>
  
  <p>I want the Nr auto increment 1, ( i have setted that in the database).
  I hope someone can help me out.
  I've tried alot of things i found on google, but nothing seems to work.</p>
  
  <p>Greetz,
  Rajco</p>