I am trying to package a Windows application written in C#.NET which uses a SQL Express 2005 backend. My setup package checks for .NET Framework, SQL Express 2005 and Windows Installer, and installs the necessary components as needed. I attach to the default SQLEXPRESS database in my application. On my initial install, all works great and my application is able to attach to the database and functions correctly. However, on subsequent installs (uninstall my windows app and then re-install), when I fire up the application, I receive an open error on the database. If I uninstall my app and uninstall SQL Express each time, it works; but if I only uninstall my app, I cannot access the database and receive the open error. Here is my connection string on application start up: stConn = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + sMyPath + "Mydb.mdf;User Instance=False;Integrated Security=True;password=mypwd;persist security info=True;user id=MyAdmin ";
On application exit, do I need to detach from the the database each time? Or on uninstall, do I need to detach from the database? I am a mezzo newbie and quite frustrated at this point. Any direction would be greatly appreciated.
Kindest Regards.