C
C Newby
I have a C# type that exposes one of its properties as a DataTable.
Unfortunately, i need to use this type from a COM application ( an ASP page
to be accurate ). So I have registered my type with Regasm and can create it
and use it just fine...except when I need to reference the DataTable
property. I imagine that because ADO.NET isn't registered for COM the
property type cannot be resolved? Eitherway ... unless there is something
very simple that i am missing, I have begun writing a method that will
return a legacy ADO recordset from my C# type.
Essentially, i would like to take the DataTable object I already have and
convert it into a disconnected recordset.
So far though, I have had some issues. For example, I cannot figure out how
to call the Open method of the recordset. I keep getting "argument out of
range, etc." errors when i call it such as:
recordset.Open( null, null, ADOR.CursorTypeEnum.adOpenDynamic,
ADOR.LockTypeEnum.adLockOptimistic, 0 );
Further ahead in my code i have the following:
foreach( DataRow row in table.Rows )
{
recordset.AddNew( table.Columns, row.ItemArray );
}
Of course, I haven't been able to step through to this point yet, but I
suspect i will encounter more problems.
What am I doing wrong so far?
Is registering System.Data for COM a reasonable consideration?
Is there an easier way to do this?
Anyway ... All comments are apreciated. TIA//
Unfortunately, i need to use this type from a COM application ( an ASP page
to be accurate ). So I have registered my type with Regasm and can create it
and use it just fine...except when I need to reference the DataTable
property. I imagine that because ADO.NET isn't registered for COM the
property type cannot be resolved? Eitherway ... unless there is something
very simple that i am missing, I have begun writing a method that will
return a legacy ADO recordset from my C# type.
Essentially, i would like to take the DataTable object I already have and
convert it into a disconnected recordset.
So far though, I have had some issues. For example, I cannot figure out how
to call the Open method of the recordset. I keep getting "argument out of
range, etc." errors when i call it such as:
recordset.Open( null, null, ADOR.CursorTypeEnum.adOpenDynamic,
ADOR.LockTypeEnum.adLockOptimistic, 0 );
Further ahead in my code i have the following:
foreach( DataRow row in table.Rows )
{
recordset.AddNew( table.Columns, row.ItemArray );
}
Of course, I haven't been able to step through to this point yet, but I
suspect i will encounter more problems.
What am I doing wrong so far?
Is registering System.Data for COM a reasonable consideration?
Is there an easier way to do this?
Anyway ... All comments are apreciated. TIA//