I have developed a windows application with vs2010 and c#. I would like to know a way to backup and restore my local mdf database programmatically. With sdf database I use File Copy but it doesn’t seem to work with mdf files.
Can anyone help?
I have developed a windows application with vs2010 and c#. I would like to
Share
Try in this way:
backup
On the query window insert the following text before the backup
command
and execute (selecting the correct database) using the exclamation mark button.
Now you have a stored procedure called DO_BACKUP that you can call from your code using the normal ADO.NET objects like
SqlConnectionandSqlCommand