title: Retrieve Access .mdb database password using C#
body: <p>building an c# application that reads access data base file.
  Each database will have a different password on it. At present I am using Access Passview <a href="http://www.nirsoft.net/utils/accesspv.html" rel="nofollow noreferrer">http://www.nirsoft.net/utils/accesspv.html</a> (freeware) to read the password but i want to be able to automate it so i can assign it to a string for the OLEDB connection string.
  (screen shot of the exe when executed)</p>
  
  <p><a href="https://i.stack.imgur.com/1wgow.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1wgow.png" alt="enter image description here"></a></p>
  
  <p>The exe can be run from the command line, which is what I have tried to implement in my application</p>
  
  <pre><code>    var proc = new Process
      {
          StartInfo = new ProcessStartInfo
          {
              FileName = "accesspv.exe",
              Arguments = _filePath, 
              UseShellExecute = false,
              RedirectStandardOutput = true,
              CreateNoWindow = true,     
          }
      };
  
      proc.Start();
      while (!proc.StandardOutput.EndOfStream)
      {
          string line = proc.StandardOutput.ReadToEnd();
          Console.WriteLine(line);
         _password2016 = line;
     }
  </code></pre>
  
  <p>This does not work for me as the access passview exe runs as normal and the password doesnt display in the console.</p>
  
  <p>My main question would be 
  1. Is it possible to read the password as assign it to a variable for my connection string?
  2. Have it so the accesspv.exe runs in the background so the end user doesnt see it?</p>
  
  <p>thanks.</p>