By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,885 Members | 1,474 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,885 IT Pros & Developers. It's quick & easy.

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

P: n/a
(I posted this in the ADO.NET NG, but didn't get any responses)

I've started getting this exception since installing vs2005
"COM object that has been separated from its underlying RCW cannot be used."
The code this is causing the exception is:
<code>
try
{
m_command.CommandText = GetAccessSprocString(m_spDeleteProtocol);
m_command.Parameters.Clear();
OleDbParameter param = new OleDbParameter("_protocolID",
protocol.ProtocolID);
m_command.Parameters.Add(param);

// open the connection and execute the update
m_connection.Open();
m_command.ExecuteNonQuery(); // THIS IS THE LINE THAT CAUSES
THE EXCEPTION
}
catch (OleDbException e)
{
m_log.LogError(e.Message, new StackFrame(true));
}
catch (Exception ee)
{
m_log.LogError(ee.Message, new StackFrame(true));
}
finally
{
m_connection.Close();
}
</code>
I honestly can't tell what is doing this. Googling hasn't shed much light.
Anyone know common causes for this exception?
Thanks for any help,
Steve
Dec 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Steve,

I would try and create the connection object once in the method itself,
and not store it on the class level as a field.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steve" <ss*@sss.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
(I posted this in the ADO.NET NG, but didn't get any responses)

I've started getting this exception since installing vs2005
"COM object that has been separated from its underlying RCW cannot be
used."
The code this is causing the exception is:
<code>
try
{
m_command.CommandText = GetAccessSprocString(m_spDeleteProtocol);
m_command.Parameters.Clear();
OleDbParameter param = new OleDbParameter("_protocolID",
protocol.ProtocolID);
m_command.Parameters.Add(param);

// open the connection and execute the update
m_connection.Open();
m_command.ExecuteNonQuery(); // THIS IS THE LINE THAT
CAUSES
THE EXCEPTION
}
catch (OleDbException e)
{
m_log.LogError(e.Message, new StackFrame(true));
}
catch (Exception ee)
{
m_log.LogError(ee.Message, new StackFrame(true));
}
finally
{
m_connection.Close();
}
</code>
I honestly can't tell what is doing this. Googling hasn't shed much
light.
Anyone know common causes for this exception?
Thanks for any help,
Steve

Dec 20 '05 #2

P: n/a
Hi Nicholas,

OK, I tried that and I still get the exception. Very weird. I can't really
find much on google either. Any other ideas?

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OE**************@TK2MSFTNGP10.phx.gbl...
Steve,

I would try and create the connection object once in the method itself,
and not store it on the class level as a field.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steve" <ss*@sss.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
(I posted this in the ADO.NET NG, but didn't get any responses)

I've started getting this exception since installing vs2005
"COM object that has been separated from its underlying RCW cannot be
used."
The code this is causing the exception is:
<code>
try
{
m_command.CommandText = GetAccessSprocString(m_spDeleteProtocol);
m_command.Parameters.Clear();
OleDbParameter param = new OleDbParameter("_protocolID",
protocol.ProtocolID);
m_command.Parameters.Add(param);

// open the connection and execute the update
m_connection.Open();
m_command.ExecuteNonQuery(); // THIS IS THE LINE THAT
CAUSES
THE EXCEPTION
}
catch (OleDbException e)
{
m_log.LogError(e.Message, new StackFrame(true));
}
catch (Exception ee)
{
m_log.LogError(ee.Message, new StackFrame(true));
}
finally
{
m_connection.Close();
}
</code>
I honestly can't tell what is doing this. Googling hasn't shed much
light.
Anyone know common causes for this exception?
Thanks for any help,
Steve


Dec 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.