Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
an attempt to attach an auto-named database for file
E:\ Default Company Name \Cloth Invenotry \Garment.mdf failed .
A database with the same name exists or specified file cannot be opened or it is located on UNC share.
(in winodow based application )
Posted

1 solution

When testing the import into IIS7.5 and after getting an error I always changed the database name for the next test - ie I started off with myDB01 and on the second attempt I called it myDB02 etc.

I always selected the option not to include the App_Data folder and I always added a custum script as follows:

CREATE USER [SomeUserName]

FOR LOGIN [IIS APPPOOL\DefaultAppPool]

GO

EXEC sp_addrolemember 'db_datareader', 'SomeUserName'

GO

After testing 30 times I finally was able to load it into IIS7.5 without errors. The connection string for the destination database that finally worked was:

Data Source=localhost\SQLExpress;Initial Catalog=MyDatabaseName;User ID=SomeUserName' ;Integrated Security=SSPI;Persist Security Info=False

And the connection string that I put into the web.debug.config for web transformation was:

Data Source=localhost\SQLExpress;Initial Catalog=MyDatabaseName;Trusted_Connection=Yes;Persist Security Info=False

I hope this helps.
 
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