Cannot insert data into Local Database in WPF

后端 未结 2 1931
北荒
北荒 2021-01-20 14:37

In a project, I have a local database, (I am using the datagrid to view the data), but the problem is that when I insert into database using the insertion query, the inserti

2条回答
  •  半阙折子戏
    2021-01-20 15:22

    In what folder is your application running? If it is in the Program Files tree you likely do not have write permissions to the sdf file (especially on Windows 7 unless you have turned off UAC or are elevating your app prior to execution).

    Even if that is not your short term issue I would recommend finding a different place for the sdf file, such as one of the AppData locations. Expecting to be able to write to your install location is not a guaruntee and depends on how and where your app is deployed.

提交回复
热议问题