You probably need to write your own Serlialiable class.
You will have 3 constructors.
Here is one of them.
public class MyClass
{
private SqlReader m_sr = null;
MyClass( SqlReader sr )
{
this.m_sr = sr;
}
}
You can try that and expose a property for m_sr.
However, you may have to parse m_sr and provide member variarbles/properties
for the items of m_sr you want to deal with.
Then you try this:
abc.Data.Add("MyClassKey" , new MyClass ( TheReader ));
I think thats a good way to try it. But its just an idea.
<ne***************@charter.net> wrote in message
news:t7*************@fe06.lga...
A System.Exception has a Data property that I would like to add data to
before I call my standard exception handler. When in a routine that uses
SQL server I would like to add the
System.Data.SqlClient.SqlConnectionSQLConnection,
System.Data.SqlClient.SqlCommand and System.Data.SqlClient.SqlDataReader
when there is one.
Exception abc = new Exception("abc");
abc.Data.Add("TheConnection",TheConnection);
abc.Data.Add("TheSQLCommand", TheSQLCommand);
abc.Data.Add("Reader", TheReader);
This compiles but at run time an exception is thrown because these are not
serialiazable. How can I put these into the Excpetions data property?
Thanks