O
olympus_mons
Hi,
the problem I have, is that the GetChildRows() method does not work. I
get error:
Unable to cast object of type 'DEBTORRow[]' to type 'DEBTOR_NACERow[]'
DEBTOR and DEBTOR_NACE. Using the object browser I can see that class
DEBTORRow has a GetChildRows method. The VS generated the follwoing
code from the data set designer:
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public DEBTOR_NACERow[] GetDEBTOR_NACERows() {
return ((DEBTOR_NACERow[])
(base.GetChildRows(this.Table.ChildRelations["R_DEBTOR_NACE_DEBTOR"])));
}
So there are number of things I don't understand here:
(1) the code above looks correct; why do I get the error mentioned
above when I call GetChildRows() like this:
DEBTOR_NACERow[] drNaceRows = drDebtor.GetDEBTOR_NACERows();
Note that drDebtor is of type DEBTORRow
(2) If I check the code generated by the data set designer, I can see
that this relation is added to the relations collection of the data
set class in InitClass() method:
this.relationR_DEBTOR_NACE_DEBTOR = new
System.Data.DataRelation("R_DEBTOR_NACE_DEBTOR", new
System.Data.DataColumn[] {
this.tableDEBTOR.DEBTOR_SEQColumn}, new
System.Data.DataColumn[] {
this.tableDEBTOR_NACE.DEBTOR_SEQColumn},
false);
this.Relations.Add(this.relationR_DEBTOR_NACE_DEBTOR);
I expected that this relation is also added to the relations
collection of the data table for DEBTOR. But it is not. So how can
this.Table.ChildRelations["R_DEBTOR_NACE_DEBTOR"] work at all in
GetDEBTOR_NACERows()?
Am I making something wrong or is the code generated by the data set
designer wrong?
Thanks,
Stefan (C# newbie)
the problem I have, is that the GetChildRows() method does not work. I
get error:
Unable to cast object of type 'DEBTORRow[]' to type 'DEBTOR_NACERow[]'
I generated a typed dataset in VS2005. There is a 1:n-relation betweenFrom the database (oracle10gR2 using Oracle .NET provider v2.0.50727)
DEBTOR and DEBTOR_NACE. Using the object browser I can see that class
DEBTORRow has a GetChildRows method. The VS generated the follwoing
code from the data set designer:
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public DEBTOR_NACERow[] GetDEBTOR_NACERows() {
return ((DEBTOR_NACERow[])
(base.GetChildRows(this.Table.ChildRelations["R_DEBTOR_NACE_DEBTOR"])));
}
So there are number of things I don't understand here:
(1) the code above looks correct; why do I get the error mentioned
above when I call GetChildRows() like this:
DEBTOR_NACERow[] drNaceRows = drDebtor.GetDEBTOR_NACERows();
Note that drDebtor is of type DEBTORRow
(2) If I check the code generated by the data set designer, I can see
that this relation is added to the relations collection of the data
set class in InitClass() method:
this.relationR_DEBTOR_NACE_DEBTOR = new
System.Data.DataRelation("R_DEBTOR_NACE_DEBTOR", new
System.Data.DataColumn[] {
this.tableDEBTOR.DEBTOR_SEQColumn}, new
System.Data.DataColumn[] {
this.tableDEBTOR_NACE.DEBTOR_SEQColumn},
false);
this.Relations.Add(this.relationR_DEBTOR_NACE_DEBTOR);
I expected that this relation is also added to the relations
collection of the data table for DEBTOR. But it is not. So how can
this.Table.ChildRelations["R_DEBTOR_NACE_DEBTOR"] work at all in
GetDEBTOR_NACERows()?
Am I making something wrong or is the code generated by the data set
designer wrong?
Thanks,
Stefan (C# newbie)