Skip navigation
chandrasekhar439
Currently Being Moderated

COM object that has been separated from its RCW cannot be used

Apr 23, 2012 9:51 PM

Tags: #c#

Hi every one,

I am getting the following error "COM object that has been separated from its RCW cannot be used"

private void BtnNew_Click(object sender, EventArgs e)
      {
         TxtBx.Text = string.Empty;
          axAcroPDF1.Dispose();
         scancontinue = false;
         num = 0;
      }

private void BtnSave_Click(object sender, EventArgs e)
      {
         // PnlGeneral.Visible = false;
          {
              BtnScan.Enabled = true;
              if (Isvalid())
              {
                  SqlCommand cmd = new SqlCommand("sp_GenDocuments", con);
                  cmd.CommandType = System.Data.CommandType.StoredProcedure;
                  cmd.Parameters.AddWithValue("@DocName", TxtBx.Text);
                  cmd.Parameters.AddWithValue("@DateCreated", Dtpc.Text);
                  cmd.Parameters.AddWithValue("@DocLocation", paths);
                  //cmd.Parameters.AddWithValue("@DocLocation", path);
                  cmd.Parameters.AddWithValue("@UserName", Login.currentuser);
                  cmd.Parameters.AddWithValue("@imgno",   popuprds.noRecord);
                  if (con.State != ConnectionState.Open)
                      con.Open();
                  int i = cmd.ExecuteNonQuery();
                  if (i > 0)
                  {
                      MessageBox.Show("Record inserted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                      axAcroPDF1.LoadFile(paths); --------> I am getting error here when i tried to load the pdf for second time
                  }
                  else
                  {
                      MessageBox.Show("Record not inserted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

                  }  
          }
          }
      }

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points