在 vb.net 中的可执行路径中创建备份和还原

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

看来我在这里遇到了一些困难 google 中的一些问题很不适合我的问题。

my backup code:

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

my restore code:

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

我希望我的备份始终在我的 exe 文件所在的位置或附近。我认为这是可能的。

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

.ExecutablePath 方法 returns 可执行文件名也...你需要使用这个:

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