System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file "Location"

W

weird0

System.Data.SqlClient.SqlException: An attempt to attach an auto-
named database for file "Location" failed. A database with the same
name exists, or specified file cannot be opened, or it is located on
UNC share.

I am getting the above the exception while connecting to the db and i
have written a web-service...
i.e. a webmethod.

What do I do? Why am i getting this error ? How can i remove this
error so i can start coding.....
 
A

Alberto Poblacion

weird0 said:
System.Data.SqlClient.SqlException: An attempt to attach an auto-
named database for file "Location" failed. A database with the same
name exists, or specified file cannot be opened, or it is located on
UNC share.

I am getting the above the exception while connecting to the db and i
have written a web-service...
i.e. a webmethod.

It's a problem in your connection string. You are probably using Sql
Server Express in the "user instance" mode, and something is wrong in the
parameters that you are providing in the connectionstring. For instance,
your attachdbfilename parameter may be pointing to a file that doesn't
exist, or that is not accessible to the user identity that is executing the
web service.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top