我正在尝试使用我朋友发送的数据库。他使用Sql Server Management Studio创建了它。在包含该.mdf
文件时,我收到一条错误消息(我在答案末尾提到了该错误)。我认为这是因为连接字符串的不同。我是 .NET 的新手,所以我只是更改了连接字符串中的名称,
从,
<add name="ApplicationServices" connectionString="Data Source=sheroz;Initial Catalog=FLEXIFORMDB;integrated security=SSPI"/>
</connectionStrings>
至,
<add name="ApplicationServices" connectionString="Data Source=Fahad-PC\Fahad;Initial Catalog=FLEXIFORMDB;integrated security=SSPI"/>
</connectionStrings>
请帮助我让它工作。提前致谢。
错误
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
at Microsoft.SqlServer.Management.Smo.Server.AttachDatabaseWorker(String name, StringCollection files, String owner, AttachOptions attachOptions)
at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)
===================================
Unable to open the physical file "D:\FlexiFormWF\FlexiFormWF\FlexiFormDB.mdf". Operating system error 5: "5(Access is denied.)". (.Net SqlClient Data Provider)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.1600&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476
------------------------------
Server Name: FAHAD-PC\MSSQL
Error Number: 5120