Backup and Restore an mdf and ldf file. Is file copy a good method? RRS feed

  • Question

  • I'm currently developing a program using C# and SQL server 2005 Express edition. the database is using a database file (i.e the mdf and the ldf.) 
    i need to design an interface to back up and retore the database (i.e the mdf and ldf files).

     i do not think the backup sql statement will work since this is not the sql server, but a database file. 

    so i though of closing the connection, and then copying (or restoring) the file and then opening the connection. 
    is this method correct? if so, how can i close the connection, and then copy the file in to a location where the user selects (using a folder browser or something related.)??

    if this is not the method, what do you suggest me to do? how can i backup my mdf and ldf files ???

    pls pls pls help me its appreciated if you can gimme a code exmple. 

    thank you very much.. :(

    .NET Rocks !! :D
    • Moved by Michael Sun [MSFT]Microsoft employee Friday, October 17, 2008 3:18 AM Off Topic for Visual C# General [loc] (Moved from Visual C# General to Off-Topic Posts (Do Not Post Here))
    Wednesday, October 15, 2008 1:27 AM