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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement