Hi All ...
I am not facing a problem while connecting to sql server 2005 databse, when i attach that first, in management studio, then I can access that from localhost, its fine at this point. but when i detach that database from management studio i am facing the follwing error while accessing it from localhost i.e.
System.Data.SqlClient.SqlException: Unable to open the physical file "D:\database\Hunzian.mdf". Operating system error 5: "5(Access is denied.)". An attempt to attach an auto-named database for file D:\database\Hunzian.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
The connection string to access that database is
undefined=@."Data
I will be happy to have your replies .
I am confused over " detach that database from management studio " - are just closing the connection for SQL Management Studio or are you detaching it.
Where is the database located w.r.t. to the localhost you refer to - is it on one of its drives or on a network share?
|||
Hi ... thanks for the reply ...
I am actually detaching the database from management studio, that database is actually situated at one of my local drive D:\Database\database.mdf. When I detach that database I am facing the above mentioned problem.
Regards
|||
Hi,
Is this error message thrown when you click detach? I think it might be generated when you connect to this database. Please check if you have granted proper permission on that folder to ASPNET account or Network Service account.
|||
Thanks,
When i detach the database from Management Studio, acctually i get this error while i try to connect to the database through localhost.
I am able to connect to the database when i attach database first from management studio then connect through localhost
What i want is:
I have detached the database from management studio, its fine uptill now, but i want to connect to that database from localhost without attaching it in management studio.
I hope you understood the scenario, the connection string works just fine while testing that in visual studio built in web server. I have already given permissions to ASPNET user.
Regards,