0

my application backup is not able to locate the database file when I instal the application setup
it only works when I debug it.
this is my code:

dim path as string = application .StartupPath & "\POPdatabase.mdb"
dim backup as new folderBrowserDialog
if folder.showdialog()=windows .forms.dialogResult.OK Then
backuptextbox.text =folder.selectedPath 
End if   
copyfile(path,ackuptextbox.text "/POP.mdb")
2
Contributors
1
Reply
12
Views
3 Years
Discussion Span
Last Post by Ancient Dragon
0

This worked for me ok (note: I changed the name of the database to be one that's already on my computer). Also used System.IO.File.Copy() instead of win32 api copyfile().

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim path As String = Application.StartupPath & "\Database1.accdb"
        Dim backup As New FolderBrowserDialog
        Dim backuptext As String
        If backup.ShowDialog() = Windows.Forms.DialogResult.OK Then
            backuptext = backup.SelectedPath
        End If
        System.IO.File.Copy(path, backuptext & "/POP.mdb")
    End Sub

Edited by Ancient Dragon

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.