If you want to populate a datatable object with results retrieved from a FetchXML query, there are several differences in how the results are returned compared with a typical SQL query:
The attached class has two methods. First, the public ExecuteFetchXml method takes a string representation of a FetchXML query and a reference to a CRM instance organization web service as input parameters, and then it executes the query and returns the results in a datatable. The private getAttributeValue is used to get useful values for the following CRM datatypes:
Building this sample requires the Microsoft Dynamics CRM SDK. Additionally, if you create a solution from scratch and copy the class file into it, you will need to add a reference to the System.Runtime.Serialization assembly.