Im working on a program to save Passwords.
I want to write them in a local database file (Name: Database.sdf).
This is my SQL query:
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();
But somehow it doesnt work. This is my database setup: https://i.sstatic.net/Q348R.jpg
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.
Greetz, Rajco
ExecuteNonQuery. 4) Don't store your passwords as a plain text.