简体   繁体   中英

Installer c# windows form app/sdf database

I did ac# windows form app that uses a local .sdf database (SQL Server Compact Edition) but I can't create an installer for that.

I use the setup wizard from Visual Studio but the intalled program gives me an unhandled exception error. I don't know if the error is the connection string or other.

My problem is not access the .sfd database but create a setup in order to install the application in other computers. To create an installer project I used the setup wizard project of visual studio 2010 but when I install the application using the generated setup the program does not run. My problem is that I don't know how to create a setup for my application. The connection string is "Data Source = |DataDirectory|DataBase\\yyyy.sdf" in the app.config. I don't have any code for the installer.

In order to find that out please show us your code, but at least wrap your DB methods in a try-catch block:

try
{
  // do your DB stuff here
}
catch (Exception ex)
{
  MessageBox.Show(ex.Message);
}

Without having seen your code, check that you don't hard code paths to the .sdf as an example. Further, are you distributing all the required dependencies for SQL Server Compact ? Remember to not install the .sdf in the program files Folder, as it violates Window's user Access model.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM