Last post Aug 04, 2014 01:16 PM by aspkermit
Aug 01, 2014 06:33 PM|aspkermit|LINK
Could someone please show me how to pass values I am returning from a broker service into a DataTable? Here is what I have so far:
DataTable dtPricingInfo = new DataTable();
List<ResponseItem> outputXml = oPricing.GetItemCostSellService
ResponseItem RITM = outputXml.First();
Originally I had this. . .
for (int i = 4; i < 13; i++)
dtPricingInfo.Rows[parentNode.Item(i).Name] = parentNode.Item(i).InnerText;
. . . but my understanding is that i don't even need to do any looping now and that the service is handling all that and that i can call the properties directly from the service like this:
. . . and even replace a DataTable with a direct call from the object.
If someone could help explain this to me and maybe show me an example it would be greatly appreciated.
Aug 04, 2014 03:54 AM|Shawn - MSFT|LINK
Based on what I understand, you are trying to invoke the broker service in the client side and it returns the List<ResponseItem>. And you want to get the value from the list and assign the values to a datatable.
Cause the service result returns as a list<T>, if you want to get the values, you could try to use loop to get the all object values and also you could try to use the List<T>.First
Method to return the first element of a sequence.
With the codes ResponseItem RITM = outputXml.First();, then you could get the values directly.
You may refer to the followig links for more information:
Aug 04, 2014 01:16 PM|aspkermit|LINK
Could you please show me a working example? I went to those links but was unable to find a definitive answer, or at least an approach that would get me started.