function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
IWyattIWyatt 

Help Adding QueryResult to DataTable

Hey all, I am using Visual Studio 2008 and working in .NET 3.5.

I'm relatively new to programming, so I don't have a lot of background, but I am hoping someone can explain how to take the Values from the QueryResult object and get them into a datatable.

 

I've examined the sforce explorer, and the apex explorer(virtually identical), and they use some sort of XML serialization that I am not familar with.

 

Is there another way to fill the datatable with the object's values?

I will primarily be working with the Lead object.

 

Thanks,

IW

Best Answer chosen by Admin (Salesforce Developers) 
jstemperjstemper

DataSet ds = new DataSet();

 

ds.ReadXml(Your XML stream here);

 

Your results are now in the second table in your dataset. i.e. ds.Tables[1] or ds.Tables["records"]

 

 

 

Cheers

All Answers

IWyattIWyatt

Hey all, based on the lack of response, I'm guessing that working with XML is the best method for retrieving data.

 

Are there any walk-throughs or code examples for basic retrieving of lead information, and then parsing the XML result for that data to load into a data table?

 

Thanks,

IW

JPClarkJPClark

You can open a datatable from an XML document. Look on MS site:

http://msdn.microsoft.com/en-us/library/fx29c3yd.aspx

 

jstemperjstemper

DataSet ds = new DataSet();

 

ds.ReadXml(Your XML stream here);

 

Your results are now in the second table in your dataset. i.e. ds.Tables[1] or ds.Tables["records"]

 

 

 

Cheers

This was selected as the best answer