Creating Backup and Restore where the Executable path in vb.net

165 views Asked by At

it seems i have some difficulty here some of the questions in google is quite not suited for my problem.

my backup code:

mb.ExportToFile(" '" & Application.ExecutablePath & "'\backup.sql")

my restore code:

mb.ImportFromFile(" '" & Application.ExecutablePath & "'\backup.sql")

i want that my back up is always where my exe file or near. i think this is posible.

it says: "The given path's format is not supported."

1

There are 1 answers

3
Marc Johnston On BEST ANSWER

The .ExecutablePath method returns the executable name also ... you need to use this one:

mb.ExportToFile(System.IO.Path.GetDirectoryName(Application.ExecutablePath) & "\backup.sql")