How to attach .mdf file to .SQLEXPRESS

后端 未结 5 1670
死守一世寂寞
死守一世寂寞 2021-01-05 16:41

Tried this in as connection string

connectionString=\"Server=.\\SQLEXPRESS;
    AttachDbFilename=E:\\Database\\dnn49.mdf;Database=dnn49; 
    Trusted_Connect         


        
5条回答
  •  隐瞒了意图╮
    2021-01-05 16:58

    If you're attaching from SQL Server Management Studio, it also works to run SSMS as an administrator. This then can take advantage of the fact that the Administrators group has full control over the file. Another much more rare circumstance is that you'll get this Access Denied error because the database is already attached. This is probably more obvious unless you have multiple instances of SQL Server running and you already attached it to another instance possibly.

提交回复
热议问题