471,317 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

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

(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
2 8032
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
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.

Similar topics

reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.