Why can't I insert data into local database (SQL Compact Edition) with C#?

后端 未结 3 523
青春惊慌失措
青春惊慌失措 2021-01-14 17:23

I am doing a project on Visual Studio. I am using a local database (empty sql server compact edition). I chose Dataset and created my table (Images). It has a primary autoin

3条回答
  •  伪装坚强ぢ
    2021-01-14 18:09

    I do not use Eclipse, but something you must watch out for in Visual Studio when debugging local databases is the Copy file property for the database file in Solution Explorer.

    By default this property is "Copy", which means a copy of the database is put in the bin\debug folder of your project and the connection string is to the copy. If you change the copy, your original file is not changed and the changes are discarded when your debug session exits.

    See if your IDE copies the database and inspect the connection string. Also how are you "checking the data table"? Are you using the same connection string? Are you doing this after the debug session ends?

提交回复
热议问题