Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using strongly typed datasets in a remoting scenario.
Message
From
27/08/2002 00:45:48
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00693728
Message ID:
00693923
Views:
23
Rodney,

I remember many months ago, when we were trying to figure out the best way to deal with data, we messed around with Merge() and ran into problems, but I can't recall what they were. We decided *not* to use that approach.

I think it would be easier if your C# middle tier returned an XML string instead of a DataSet. Then your VB class could simply read the XML into your CorporationDataSet. This is basically the approach that we have used. Can you change the behavior of your C# class? If not, you can still take the untyped DataSet that is returned from the C# class, write it to XML and then read it back into the typed DataSet.

~~Bonnie



>Hi Bonnie,
>
>My C# middle tier is returning a dataset. From what I've read, when doing remoting, all datasets are returned as untyped. In order to get a strongly typed dataset, I have added the .vb file created from the XML Schema Designer to the solution. I then created an instance of the strongly typed dataset, and an instance of an untyped dataset. When I make the call to the middle tier, I'm passing the untyped dataset as the reference. Once the call is complete I'm using the merge method of the strongly typed dataset to import the data from the untyped dataset. It seems I can access the fields by name after that, however, when I try doing a row find using the primary key I keep getting nothing returned back to me. The row object is always nothing. I have checked the data and it is valid. Not sure what I'm doing wrong. I suspected the primary key wasn't there, but perhaps it is something else I'm doing wrong. I've attached the code in question.
>
>Dim dsStrong As New CorporationDataSet()
>Dim objCorporation As ICorporation
>Dim type As Type = GetType(ICorporation)
>Dim intErr As Int32
>Dim intTest As Int32 = 1
>
>objCorporation = CType(Activator.GetObject(type, "tcp://.../Corporation"), ICorporation)
>
>intErr = objCorporation.GetCorporations(CreditUnionID, ActiveType.ALL, mdsCorporations)
>
>dsStrong.Merge(mdsCorporations)
>Dim tbl As CorporationDataSet.CorporationDataTable = dsStrong.Corporation
>Dim row As CorporationDataSet.CorporationRow()
>row = tbl.FindByCorporationID(intTest)
>If row Is Nothing Then
> Console.WriteLine("Row not found")
>Else
> Console.WriteLine("Found " & row.NameVC & " - " & row.CorporationID)
>End If
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform