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).
It exists in a specific namespace are you importing it?
System.Data.DataTableExtensions.CopyToDataTable()
Also confirm the addition of this reference
System.Data.DataSetExtensions