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. restore

restore

Scheduled Pinned Locked Moved C#
csharpdatabasemysqlsysadminhelp
8 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
    nitish_07
    wrote on last edited by
    #1

    BasePriority = 'process.BasePriority' threw an exception of type 'System.InvalidOperationException'...This is the exception I am getting while restoring the database from my .net application..Here I am providing the code....

    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 (x86)\\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;
    
                Console.WriteLine(psi);
                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!");
            }
    

    Plz provide any suggestion....

    A P 2 Replies Last reply
    0
    • N nitish_07

      BasePriority = 'process.BasePriority' threw an exception of type 'System.InvalidOperationException'...This is the exception I am getting while restoring the database from my .net application..Here I am providing the code....

      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 (x86)\\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;
      
                  Console.WriteLine(psi);
                  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!");
              }
      

      Plz provide any suggestion....

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      You cannot set the BasePriorty as this is a read only Property. The return type of this property is an integer. Read more about this here[^] . You have not provided the code for this statement, so its hard to figure out what you were trying to do.

      P N 2 Replies Last reply
      0
      • A Abhinav S

        You cannot set the BasePriorty as this is a read only Property. The return type of this property is an integer. Read more about this here[^] . You have not provided the code for this statement, so its hard to figure out what you were trying to do.

        P Offline
        P Offline
        ProEnggSoft
        wrote on last edited by
        #3

        To the point. +5

        1 Reply Last reply
        0
        • N nitish_07

          BasePriority = 'process.BasePriority' threw an exception of type 'System.InvalidOperationException'...This is the exception I am getting while restoring the database from my .net application..Here I am providing the code....

          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 (x86)\\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;
          
                      Console.WriteLine(psi);
                      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!");
                  }
          

          Plz provide any suggestion....

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          Yeah, I don't see such a statement, but maybe you need something like this:

              try
              {
                process.PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal ;
              }
              catch
              {
                /\* The process probably already exited due to error \*/
              }
          
          A 1 Reply Last reply
          0
          • P PIEBALDconsult

            Yeah, I don't see such a statement, but maybe you need something like this:

                try
                {
                  process.PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal ;
                }
                catch
                {
                  /\* The process probably already exited due to error \*/
                }
            
            A Offline
            A Offline
            altafmohd
            wrote on last edited by
            #5

            yes sir process is already exiting due to error .........i am also unable to understand why the process is exiting ...give some solution thanks

            P 1 Reply Last reply
            0
            • A altafmohd

              yes sir process is already exiting due to error .........i am also unable to understand why the process is exiting ...give some solution thanks

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              You'll need to check the output. You may need to redirect and capture the output.

              A 1 Reply Last reply
              0
              • P PIEBALDconsult

                You'll need to check the output. You may need to redirect and capture the output.

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

                how i can do this ....provide what code i should use or steps to do that thanks in advance :):):)

                1 Reply Last reply
                0
                • A Abhinav S

                  You cannot set the BasePriorty as this is a read only Property. The return type of this property is an integer. Read more about this here[^] . You have not provided the code for this statement, so its hard to figure out what you were trying to do.

                  N Offline
                  N Offline
                  nitish_07
                  wrote on last edited by
                  #8

                  As pointer reach to line Process process=process.start(psi), command line windows opens for a second and then closes and when after this line I watch the output it throws that exception that process has existed....

                  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