how to copy a sql server database using C# code

Sep 27 2010 6:39 AM


hai expert................
how to copy a sql server database using C# code . I was using the following code
File.Copy("dbRDAgent.mdf", "" + strpath + "\\dbRDAgent.mdf");
an error occures that "the process cannot access the file "dbRDAgent.mdf" because it is being used by another process."

thanks in advance......

Answers (4)