Database Error While running exe file RRS feed

  • Question

  • Hi experts

    I created setup for my Windows app.I am getting an error message when i run exe file  that reads "an attempt to attach an auto-named database for file C:\program files\Default company\setup1\Test.mdf faild A database with the same name exsits or specified file cannot be opened or it's located on UNC share .  I am using Visual Studio 2005, Sql server 2005, windows7.  Any suggestions?

    Saturday, July 3, 2010 4:37 PM


  • Hello,

    Please check the following items

    1. The connection and connection strings in config file. It should be like this:
        <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Persist Security Info=True;Integrated Security=SSPI;User Instance=True" providerName="System.Data.SqlClient" />
    2. Please follow up this thread and see if the comments can provide help. As you can see, you may encounter this issue when you bind your data to a customer control.

    Best regards

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Tuesday, July 6, 2010 10:02 AM