DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 05 Aug 2007 04:54:01 -0700,    posted on: microsoft.public.dotnet.framework.adonet        back       

Thread Index
  1    unknown
          2    unknown
          3    unknown


Fighting with typed data set and child relation   
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[]'


>From the database (oracle10gR2 using Oracle .NET provider v2.0.50727)

I generated a typed dataset in VS2005. There is a 1:n-relation between
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)
Date:Sun, 05 Aug 2007 04:54:01 -0700   Author:  

Re: Fighting with typed data set and child relation   
Hi again,

I worked arround my problem by writing code (and not using the code
generated by VS' data set designer). However I still wish to find out
what is really the cause for the problem: is i me and my still limited
VS/C# knowledge or is it VS?

If anybody is willing to help me please contact me by private email
and I will provide a very small sample (SQL script to create simple
parent and child table with some data and C# console application). I
will also provide the DataSet.Designer.cs file generated from VS' data
set designer.

Thanks,
Stefan
Date:Mon, 13 Aug 2007 04:40:17 -0700   Author:  

Re: Fighting with typed data set and child relation   
I found it: the problem is a bug in VS2005. Even SP1 provides no fix.
MS just states that it will be fixed in the next VS release, but
provides no info which release this is.

See:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=114983

For a work arround see:
http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=114983

Stefan
Date:Tue, 14 Aug 2007 01:42:46 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us