Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. problem with backup of data base

problem with backup of data base

Scheduled Pinned Locked Moved Visual Basic
helpdatabasevisual-studiodebugging
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nazimghori
    wrote on last edited by
    #1

    hello every one i am using VS 2005 now i am having mdi form in that i am having 1 toolstrip menu item of backup which has the functionality of backup of my whole database for that i wrote code like

    imports system.io
    Directory.CreateDirectory("c:\ backup")

        Dim a As String = " c:\\myproject\\bin\\debug\\my.mdf"
        Dim d As String = "c:\\backup\\my.mdf"
        FileCopy(a, d)
    
        MsgBox("backup Successfully")
    

    but the problem is the directory name backup is created but data base is not copied in it please help :) :)

    R Z D 3 Replies Last reply
    0
    • N nazimghori

      hello every one i am using VS 2005 now i am having mdi form in that i am having 1 toolstrip menu item of backup which has the functionality of backup of my whole database for that i wrote code like

      imports system.io
      Directory.CreateDirectory("c:\ backup")

          Dim a As String = " c:\\myproject\\bin\\debug\\my.mdf"
          Dim d As String = "c:\\backup\\my.mdf"
          FileCopy(a, d)
      
          MsgBox("backup Successfully")
      

      but the problem is the directory name backup is created but data base is not copied in it please help :) :)

      R Offline
      R Offline
      Rajesh Anuhya
      wrote on last edited by
      #2

      I think the problem is Directory.CreateDirectory("c:\ backup") Remove the space after "\" :-\

      Rajesh B --> A Poor Workman Blames His Tools <--

      N 1 Reply Last reply
      0
      • R Rajesh Anuhya

        I think the problem is Directory.CreateDirectory("c:\ backup") Remove the space after "\" :-\

        Rajesh B --> A Poor Workman Blames His Tools <--

        N Offline
        N Offline
        nazimghori
        wrote on last edited by
        #3

        hello i tried by removing space but still it doesnot copy my.mdf file to backup directory please suggest... thank you... :) :)

        L 1 Reply Last reply
        0
        • N nazimghori

          hello i tried by removing space but still it doesnot copy my.mdf file to backup directory please suggest... thank you... :) :)

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          remove space from Dim a As String = " c:\myproject\bin\debug\my.mdf"?

          Check out the CodeProject forum Guidelines[^]

          1 Reply Last reply
          0
          • N nazimghori

            hello every one i am using VS 2005 now i am having mdi form in that i am having 1 toolstrip menu item of backup which has the functionality of backup of my whole database for that i wrote code like

            imports system.io
            Directory.CreateDirectory("c:\ backup")

                Dim a As String = " c:\\myproject\\bin\\debug\\my.mdf"
                Dim d As String = "c:\\backup\\my.mdf"
                FileCopy(a, d)
            
                MsgBox("backup Successfully")
            

            but the problem is the directory name backup is created but data base is not copied in it please help :) :)

            Z Offline
            Z Offline
            Zaegra
            wrote on last edited by
            #5

            If Not IO.directory.exists("C:\Backup") Then
            IO.Directory.Create("C:\Backup")
            End If

            Dim a As String = "C:\Myproject\bin\debug\my.mdf"
            Dim d As String = "C:\Backup\my.mdf"
            IO.File.Copy(a,d)
            MsgBox("Backup of 'my.mdf' was succesfull.")

            This should do the trick. :)

            Motivation is the key to software development.

            N 1 Reply Last reply
            0
            • Z Zaegra

              If Not IO.directory.exists("C:\Backup") Then
              IO.Directory.Create("C:\Backup")
              End If

              Dim a As String = "C:\Myproject\bin\debug\my.mdf"
              Dim d As String = "C:\Backup\my.mdf"
              IO.File.Copy(a,d)
              MsgBox("Backup of 'my.mdf' was succesfull.")

              This should do the trick. :)

              Motivation is the key to software development.

              N Offline
              N Offline
              nazimghori
              wrote on last edited by
              #6

              hello i tried with code you suggested but this is not working... there is still no copy of my.mdf file is made to Backup folder.. just folder with blank data is created in c drive... please suggest...

              L Z 2 Replies Last reply
              0
              • N nazimghori

                hello i tried with code you suggested but this is not working... there is still no copy of my.mdf file is made to Backup folder.. just folder with blank data is created in c drive... please suggest...

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Does C:\Myproject\bin\debug\my.mdf exist? Does C:\Backup\my.mdf exist?

                Check out the CodeProject forum Guidelines[^]

                1 Reply Last reply
                0
                • N nazimghori

                  hello i tried with code you suggested but this is not working... there is still no copy of my.mdf file is made to Backup folder.. just folder with blank data is created in c drive... please suggest...

                  Z Offline
                  Z Offline
                  Zaegra
                  wrote on last edited by
                  #8

                  Just curious, are you using Vista? If so, try running your program with Administrator priviliges :-D Cheers, Zaegra

                  Motivation is the key to software development.

                  1 Reply Last reply
                  0
                  • N nazimghori

                    hello every one i am using VS 2005 now i am having mdi form in that i am having 1 toolstrip menu item of backup which has the functionality of backup of my whole database for that i wrote code like

                    imports system.io
                    Directory.CreateDirectory("c:\ backup")

                        Dim a As String = " c:\\myproject\\bin\\debug\\my.mdf"
                        Dim d As String = "c:\\backup\\my.mdf"
                        FileCopy(a, d)
                    
                        MsgBox("backup Successfully")
                    

                    but the problem is the directory name backup is created but data base is not copied in it please help :) :)

                    D Offline
                    D Offline
                    DidiKunz
                    wrote on last edited by
                    #9

                    Hello, do you use your database in your form? You won't be able to copy a open database. Regards: Didi

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups