I have install the SQL server 2008 R2 & configure the server Mixed mode authentication with username = 'sa' & password = 'pw'
and my attachment .mdf file is located in D:\TransparentTest\ForTest and service is running.
Now i connect the server2008 attachment .mdf file through coding but not connect. Error msg shown('Unable to open the physical file "D:\TransparentTest\ForTest\sd.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
An attempt to attach an auto-named database for file D:\TransparentTest\ForTest\sd.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.')
My code is below :->
--------------------
SqlConnection con = new SqlConnection();
con.ConnectionString = @"Data Source=MachineName\MSSQLSERVER2008; AttachDbFilename=D:\TransparentTest\ForTest\sd.mdf;User Id=sa;Password=pw";
con.Open();
Above code is fine working in Sql Server2005, but not working in Sql Server2008.
How will i solve above problem???
Please help me proper instruction......