database - C# SQlite INSERT INTO does not work -


I'm starting in SQLite now I'm trying to insert new records in the sample Northwind database. My C # code is below:

  SQLiteConnection myConnection = New SQLiteConnection (); MyConnection.ConnectionString = @ "Data Source = | Data Directory | \ northwindEF.db"; Use (myConnection) {SQLiteCommand myCommand = myConnection.CreateCommand (); MyCommand.CommandText = "Include categories (category ID, category name, description) values ​​(11, 'bakery', 'baked goods as bread and cake')"; MyConnection.Open (); MyCommand.ExecuteNonQuery (); MyConnection.Close (); }   

When I run this program, I did not get any errors. But my new record has not been put in the table. Please help me out what's wrong with my code.

This is a common mess for a database file stored in a connection project folder in server explorer . Then, in the runtime the database has been copied to the output directory and every insert, update, works against that database. Nothing in server explorer will change because the database is different. The same happens if the property is set to 'Copy to Output Directory' to Always Copy . In this case, in every output, the database is overwritten with the latest copy taken from the project root folder in the output directory and then disappears in the next run of every run, update or insert.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -