This following code example is borrowed from MSDN here. I am not getting query.CopyToDataTable() available in my code. (see the commented line in my following code).
Navigating further into MSDN online brings me to this page: http://msdn.microsoft.com/en-us/library/system.data.datatableextensions.aspx
It says its in the System.Data namespace (using System.Data) and you need to reference the System.Data.DataSetExtensions.dll.