User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 391,584 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,650 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser:
Views: 130 | Replies: 1
Reply
Join Date: Jun 2008
Posts: 10
Reputation: dhanashreegd is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dhanashreegd dhanashreegd is offline Offline
Newbie Poster

BackUp And Restore

  #1  
32 Days Ago
I am currently using a database within my program and I have no problem backing it up or restoring it when i am simply debugging. However if it is published and downloaded it cannot find the path that it needs to get to the database to copy it. My code is:


Public Sub backupDB()

        Dim portfolioPath As String = My.Application.Info.DirectoryPath

        FileCopy(portfolioPath & "\Information Sources\portfolioDB.mdb", "C:\Program Files\PortfolioGen2.0\DBBACKUP.mdb")

        MsgBox("Backup Successful")
    End Sub

    Public Sub restoreDB()

        Dim portfolioPath As String = My.Application.Info.DirectoryPath

        If MessageBox.Show("Restoring the database will erase any changes you have made since you last backup. Are you sure you want to do this?", _
                    "Confirm Delete", _
                    MessageBoxButtons.OKCancel, _
                    MessageBoxIcon.Question, _
                    MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.OK Then
            'Restore the database from a backup copy.
            FileCopy("C:\Program Files\PortfolioGen2.0\DBBACKUP.mdb", portfolioPath & "\Information Sources\portfolioDB.mdb")

            MsgBox("Database Restoration Successful")
        End If
Last edited by Tekmaven : 32 Days Ago at 1:23 pm. Reason: Code tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 33
Reputation: KillerOfDN is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
KillerOfDN KillerOfDN is offline Offline
Light Poster

Re: BackUp And Restore

  #2  
32 Days Ago
It could well be that My.Application.Info.DirectoryPath is not returning what you'd like after the application has been compiled. I know, for instance that the My.User.Name did'nt work with Windows Vista at one point.
Try something like Application.StartupPath & "\portfolioDB.mdb". Also, your application seems to be bound to the C:\ drive, consider using the My.Computer.FileSystem.SpecialDirectories.ProgramFiles property.

Hope this helps
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb VB.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 10:59 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC