Click here to Skip to main content
15,948,339 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have created setup and installed it but after installation when I run the application(.exe) It gives error "Unhandled exception has occurred in your application .If you click continue,the application will ignore this error & attempt to continue.If you click Quit,the application will close immediately.An attempt to attach an auto named database file "C:\User\Desktop\CarRent.mdf" failed.A database with same name exists or specified file cannot be opened,or it is located On UNC Share".Help me to solve this problem .Looking for favorable soon.Thank You.
Posted
Comments
Sergey Alexandrovich Kryukov 1-Feb-12 4:56am    
Is 5 minutes after you post soon enough? :-)

Is it obvious that there could be trillions of reasons? Our access to your hard drive is somewhat limited :-)

The is not a valid question, and it is not answerable. Needs more information.
--SA
shilpa sonawane 1-Feb-12 5:02am    
I have build a desktop application and I need to deploy it.I have Created the set up file properly and installed it .But the problem comes when i run the application(.exe )file after installation.
I have created setup and installed it but after installation when I run the application(.exe) It gives error "Unhandled exception has occurred in your application .If you click continue,the application will ignore this error & attempt to continue.If you click Quit,the application will close immediately.An attempt to attach an auto named database file "C:\User\Desktop\CarRent.mdf" failed.A database with same name exists or specified file cannot be opened,or it is located On UNC Share".Help me to solve this problem .Looking for favorable soon.Thank You.

1 solution

1. Try to put your data base in application's App_Data folder.
2. If this doesn't work than try to use this connection string below, if you created database by sql server management studio express.
Data Source=.\SQLEXPRESS;Initial Catalog=CarRent;Integrated Security=True
3. Even if all this doesn't help than try to delete already existed database from sql server but please take a backup,So when there is no attached database,It'll work fine absolutely.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900