hi guys, me again
OK so ive now detached the database from SQL Server manager, and as predicted it no longer connects, now ive added the detached files the .mdf and the log file from the detached database, and it has given me the application services connection string , as shown below, this is the actual connection string in the Web.config:
<pre><connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
<add name="TravelShopConnectionString1" connectionString="Data Source=MATTHEW-PC\SQLEXPRESS;Initial Catalog=TravelShop;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
now i know the bottom one is the direct connection to my home computer through SQLEXPRESS, and the top one is the generated string from the copied file, but the error remains the same when trying to use it in the c# code like this:
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);
does it need to be a direct file path name to the copied database?
this is the error:
[SqlException (0x80131904): An attempt to attach an auto-named database for file
C:\Users\Matthew\Desktop\testing conections\TheTravelShop\TheTravelShop\App_Data\aspnetdb.mdf failed.
A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
what does this actually mean? apart from it already exists, although i did exclude the original from the application in the server explorer.
Thanks for reading
Matt.