Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,
In a application i am using one database (eg.testing). At the end of my transaction over. I want to copy that (testing Database) to another location. I done all. But its showing error as the file(testing) is in use by another application nu. How to solve this problem. If u know help me.
Posted
Comments
Hari Om Prakash Sharma 16-Sep-11 1:16am    
Please fully explained your question and what procedure you are using to copy 'testing' database. Probably close all database connection or unlock database after your transaction is over.

In your PC's SQL Management studio....
right click the desire database and select BACK UP....
select the required path and configure name and all...
and click ok.

then copy that "*.bak" file to desired PC....
go to SQL Management studio of that PC......
right click on DATABASE and select RESTORE.........
go to path where u pasted .bak file...
and configure and click ok..

u done it........
 
Share this answer
 
Comments
ssyuvaraja 16-Sep-11 1:34am    
Thank you. I know that. But I asking, that i am trying to copy a database to another location using coding. While that application is running. I am closed the database connection but it shows error as the file is in use.
Pradeep Shukla 16-Sep-11 1:59am    
Yes..that's right because in SQL unless you detach the .mdf and .ldf the database files would always be in use.
ssyuvaraja 16-Sep-11 2:05am    
ok. Thank you. But i asked is not like that. Because if i stop the application using that Database. Then i can copy that. No need to detach that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900