Backup / Restore database problems RRS feed

  • Question

  • Hello !
    i'm working on a 2010 / NET 4  /  Entity Framework  project that use sql server 2008r2 database.
    i want to backup database .i'm using this code :
    cmd = New SqlCommand("backup database MYDB to disk='" & path & "'", con)

    ... but i'm getting an error
    Cannot open backup device 'c:\\users\user\desktop\backup.bak. Operating system error 5(Access is denied.).
    BACKUP DATABASE is terminating abnormally.
    if i change the path to "c:\\bck\backup.bak" , everything works fine. i have tested and the backup process fail on some folders like c:\ , c:\users\user\xxxxxx    ....... etc.

    the user that run the application has administratos rights and can access all these folders  through explorer.
    i want to backup my database on every destination that i  select.
    what can i do ?

    thank you.

    Monday, November 7, 2011 1:23 PM


All replies