R
Richard Myers
Hello.
I am getting an InvalidCastException which has revealed yet more of my ignorance. I cant believe i
dont already know this and haven't encountered it before until now.
I am consuming a dataset from a webservice. I wrote both the server and client apps and the both use
the same middle teir. I fill a dataset on the server that has a relationship between two of the
tables inside. The relationship is between two strongly typed tables but is added dynamically as one
of the strongly typed tables is from another strongly typed dataset.
In consuming that from the client and then attempting to fill a datastore using the consumed dataset
i get the invalid cast exception when trying to traverse the relationship from child to parent row:
budgetRow =
CType(report.GetParentRow(SalesManagementBase.RELATION_SALESAGENTPERIODREPORT_SALESFIGURES & "_B"),
_ dsSalesBudget.SalesFiguresAggregateRow)
budgetRow is of type dsSalesBudget.SalesFiguresAggregateRow.
I couldn;t understand the exception because i believed i casting from a poly morphed
dsSalesBudget.SalesFiguresAggregateRow temporarily down cast to an untyped data row by the
GetParentRow method. But it turns out the row is not poly morphed at all but simply a datarow having
been stripped of its strong type i guess by the serialization process). Command line print our below
for interest.
Can anyone bring me up to speed here? Im a little embarrassed i got caught out by this because it
reeks of *basic learning* which clearly i haven;t got. Can anyone bring me up to speed here? I get
the same schema server side, before send, and after, once captured/consumed... which i would expect
but command line shows me the tables are clearly typed differently hence the invalid cast exception:
* server side *
? reports.tables(2)
{dsSalesBudget.SalesFiguresAggregateDataTable}
[dsSalesBudget.SalesFiguresAggregateDataTable]: {dsSalesBudget.SalesFiguresAggregateDataTable}
* client side *
? reports.tables(2)
{System.Data.DataTable}
CaseSensitive: False
ChildRelations: {System.Data.DataRelationCollection.DataTableRelationCollection}
Thanks
Richard
I am getting an InvalidCastException which has revealed yet more of my ignorance. I cant believe i
dont already know this and haven't encountered it before until now.
I am consuming a dataset from a webservice. I wrote both the server and client apps and the both use
the same middle teir. I fill a dataset on the server that has a relationship between two of the
tables inside. The relationship is between two strongly typed tables but is added dynamically as one
of the strongly typed tables is from another strongly typed dataset.
In consuming that from the client and then attempting to fill a datastore using the consumed dataset
i get the invalid cast exception when trying to traverse the relationship from child to parent row:
budgetRow =
CType(report.GetParentRow(SalesManagementBase.RELATION_SALESAGENTPERIODREPORT_SALESFIGURES & "_B"),
_ dsSalesBudget.SalesFiguresAggregateRow)
budgetRow is of type dsSalesBudget.SalesFiguresAggregateRow.
I couldn;t understand the exception because i believed i casting from a poly morphed
dsSalesBudget.SalesFiguresAggregateRow temporarily down cast to an untyped data row by the
GetParentRow method. But it turns out the row is not poly morphed at all but simply a datarow having
been stripped of its strong type i guess by the serialization process). Command line print our below
for interest.
Can anyone bring me up to speed here? Im a little embarrassed i got caught out by this because it
reeks of *basic learning* which clearly i haven;t got. Can anyone bring me up to speed here? I get
the same schema server side, before send, and after, once captured/consumed... which i would expect
but command line shows me the tables are clearly typed differently hence the invalid cast exception:
* server side *
? reports.tables(2)
{dsSalesBudget.SalesFiguresAggregateDataTable}
[dsSalesBudget.SalesFiguresAggregateDataTable]: {dsSalesBudget.SalesFiguresAggregateDataTable}
* client side *
? reports.tables(2)
{System.Data.DataTable}
CaseSensitive: False
ChildRelations: {System.Data.DataRelationCollection.DataTableRelationCollection}
Thanks
Richard