如何将MDF文件附加到SQL Server 2008 [英] How to attach mdf file to sql sever 2008
问题描述
大家好,
我正在Windows应用程序上工作.我需要将现有的mdf文件添加到sql server 2008中.我将以下代码用于该程序
I am working on windows application.In that I need to add existing mdf file to sql server 2008. I used the below code for that one
昏暗
connectionString 字符串 "数据源=.\ SQLEXPRESS; AttachDbFileName = | DataDirectory | CodeDesign.mdf;集成安全性= True;"
connectionString As String = "Data Source=.\SQLEXPRESS;AttachDbFileName=|DataDirectory|CodeDesign.mdf;Integrated Security=True;"
好的,当我们第一次关闭应用程序并再次运行时,它可以在以后第一次运行该应用程序时正常运行,
ok it working fine while run the apploication for first time later if we close the application and run again then it will shows error like
无法复制文件"E:\ Running项目\ Load Calculations程序\ 05".代码\ 01.代码\负载计算程序\负载计算程序2 \ bin \ Debug \ CodeDesign.mdf"
转到"bin \ Debug \ bin \ Debug \ CodeDesign.mdf".该进程无法访问文件'E:\ Runningprojects \ Load Calculations Program \ 05.代码\ 01.代码\负载计算程序\负载计算程序2 \ bin \ Debug \ CodeDesign.mdf',因为它正在被另一个进程使用.
Unable to copy file "E:\Running projects\Load Calculations Program\05. Code\01. Code\Load Calculations Program\Load Calculation Program2\bin\Debug\CodeDesign.mdf"
to "bin\Debug\bin\Debug\CodeDesign.mdf". The process cannot access the file 'E:\Runningprojects\Load Calculations Program\05. Code\01. Code\Load Calculations Program\Load Calculation Program2\bin\Debug\CodeDesign.mdf' because it is being used by another process.
在这个问题上,谁能帮助我...
Can any one plz help me on this issue...
致谢
K.Pradeep
K.Pradeep
推荐答案
1.请先将* .mdf附加到数据库
1. Please attach the *.mdf first to the database
2.使用任何适合您的连接字符串格式来连接到该数据库目录
(连接字符串引用: http ://www.connectionstrings.com/sql-server-2008 )
2. use any of the connection string format (which suits you) to connect to that database catalogue
(connection string references: http://www.connectionstrings.com/sql-server-2008)
如果适合您,请标记为答案
Please mark it as answer if it works for you
谢谢
草山
这篇关于如何将MDF文件附加到SQL Server 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!