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. C#
  4. restoring database using c#

restoring database using c#

Scheduled Pinned Locked Moved C#
helpcsharpdatabasemysqlsysadmin
15 Posts 4 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.
  • R Ravi Bhavnani

    You'll need to provide more information - what does the mysqlimport.exe process output? /ravi

    My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

    A Offline
    A Offline
    altafmohd
    wrote on last edited by
    #3

    sir what do you mean by the output of mysqlimport.exe i did not get it .......could you please tell in detail thank you :)

    R 1 Reply Last reply
    0
    • A altafmohd

      sir what do you mean by the output of mysqlimport.exe i did not get it .......could you please tell in detail thank you :)

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #4

      I meant the result displayed by running mysqlimport.exe.  That would indicate what caused the import to fail. /ravi

      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

      A 1 Reply Last reply
      0
      • R Ravi Bhavnani

        I meant the result displayed by running mysqlimport.exe.  That would indicate what caused the import to fail. /ravi

        My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

        A Offline
        A Offline
        altafmohd
        wrote on last edited by
        #5

        no result and no exception .....and code is running till the end ......

        R 1 Reply Last reply
        0
        • A altafmohd

          no result and no exception .....and code is running till the end ......

          R Offline
          R Offline
          Ravi Bhavnani
          wrote on last edited by
          #6

          What's the value of Process.ExitCode[^] ? /ravi

          My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

          A 1 Reply Last reply
          0
          • R Ravi Bhavnani

            What's the value of Process.ExitCode[^] ? /ravi

            My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

            A Offline
            A Offline
            altafmohd
            wrote on last edited by
            #7

            sir its 1

            R 1 Reply Last reply
            0
            • A altafmohd

              sir its 1

              R Offline
              R Offline
              Ravi Bhavnani
              wrote on last edited by
              #8

              That indicates the process terminated with an error.  The fastest way (IMHO) to determine what caused the problem is to:

              1. Debug your app and see what arguments you're passing the .exe
              2. Run the .exe manually (in a command window) using those arguments and inspect the output

              /ravi

              My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

              L 1 Reply Last reply
              0
              • R Ravi Bhavnani

                That indicates the process terminated with an error.  The fastest way (IMHO) to determine what caused the problem is to:

                1. Debug your app and see what arguments you're passing the .exe
                2. Run the .exe manually (in a command window) using those arguments and inspect the output

                /ravi

                My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

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

                You, sir, should be nominated for sainthood or something. Nicely done.

                Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns

                R 1 Reply Last reply
                0
                • L Lost User

                  You, sir, should be nominated for sainthood or something. Nicely done.

                  Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns

                  R Offline
                  R Offline
                  Ravi Bhavnani
                  wrote on last edited by
                  #10

                  Thanks, Wes!  Just trying to live up to the CPian code - bad puns intended.  :) /ravi

                  My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                  A 1 Reply Last reply
                  0
                  • R Ravi Bhavnani

                    Thanks, Wes!  Just trying to live up to the CPian code - bad puns intended.  :) /ravi

                    My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                    A Offline
                    A Offline
                    altafmohd
                    wrote on last edited by
                    #11

                    sir please tell me is this line which i am passing in filename of psi is correct or not? psi.FileName = @"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqlimport.exe";

                    R 1 Reply Last reply
                    0
                    • A altafmohd

                      sir please tell me is this line which i am passing in filename of psi is correct or not? psi.FileName = @"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqlimport.exe";

                      R Offline
                      R Offline
                      Ravi Bhavnani
                      wrote on last edited by
                      #12

                      Assuming that's where MySql is installed, probably yes.  Did you try running the command manually? /ravi

                      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                      A 1 Reply Last reply
                      0
                      • R Ravi Bhavnani

                        Assuming that's where MySql is installed, probably yes.  Did you try running the command manually? /ravi

                        My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                        A Offline
                        A Offline
                        altafmohd
                        wrote on last edited by
                        #13

                        yes sir that is stored there ....ok i will run actualy there is problem in system as soon as it will be functioning well

                        1 Reply Last reply
                        0
                        • A altafmohd

                          sir i providing code by which i am implementing restore database ....but sir code is running successfully but no restoration is done at the end ...... help plz thanx in advance :)

                          public void Restore()
                          {
                          try
                          {
                          //Read file from C:\
                          string path;
                          path = filetext.Text;
                          StreamReader file = new StreamReader(path);
                          string input = file.ReadToEnd();
                          file.Close();

                                      ProcessStartInfo psi = new ProcessStartInfo();
                                      psi.FileName = @"C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\mysqlimport.exe";
                                      psi.RedirectStandardInput = true;
                                      psi.RedirectStandardOutput = false;
                                      psi.Arguments = string.Format(@"-u{0} -p{1} -h{2} {3}",
                                         userid, paswd, server, comboBox1.Text);
                                      psi.UseShellExecute = false;
                          
                          
                                      Process process = Process.Start(psi);
                                      process.StandardInput.WriteLine(input);
                                      process.StandardInput.Close();
                                      process.WaitForExit();
                                      process.Close();
                                      MessageBox.Show("database is restored");
                                  }
                                  catch (IOException ex)
                                  {
                                      MessageBox.Show("Error , unable to Restore!");
                                  }
                              }
                          
                              private void bstart\_Click(object sender, EventArgs e)
                              {
                                  Restore();
                              }
                          
                          V Offline
                          V Offline
                          Vipin_Arora
                          wrote on last edited by
                          #14

                          Hi altaf bhai, if u want to restore the DB from .bak file then try folllowing link:http://stackoverflow.com/questions/9403299/backup-and-restore-sql-database[^] It may be very useful for u

                          A 1 Reply Last reply
                          0
                          • V Vipin_Arora

                            Hi altaf bhai, if u want to restore the DB from .bak file then try folllowing link:http://stackoverflow.com/questions/9403299/backup-and-restore-sql-database[^] It may be very useful for u

                            A Offline
                            A Offline
                            altafmohd
                            wrote on last edited by
                            #15

                            sir but in this link the database is sql server and i am using mysql database ....:(

                            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