Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 Open Error on Database - subsequent app installs

Author  Topic 

pNelson
Starting Member

1 Post

Posted - 2010-06-17 : 10:34:48
I have a Windows application written in C#.NET which uses a SQL Express 2005 backend. My install checks for .NET Framework, SQL Express 2005 and Windows Installer, and installs the necessary components as needed. I attach to the default SQLEXPRESS instance in my application. On my initial install with new SQL Express install, all works great and my application is able to attach to the database, and function correctly. However, on subsequent installs (uninstall my windows app and then re-install it), 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, and then re-install, it works; but if I only uninstall my app, I receive the open error on the database. 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 ";
Do I need to detach from the database each time I exit the application? Or do I need to detach from the database prior to an application un-install? I am a mezzo-mezzo newbie so any assist would be greatly appreciated.
Kindest Regards.
   

- Advertisement -