DataSet from WebService with LINQ RRS feed

  • Question

  • Hello, I have a webservice which returns a dataset. I'm now rewriting some code for the manipulation of the results, trying to implement it with LINQ. The query is working fine, however when I try to say the following:

    var productlist = from prds in dsProducts.sk_products.AsEnumerable()
        where (prds.Field<string>("productno").Contains(searchpattern) || 
        select prds;
    return (DataSetProducts.sk_productsDataTable)productlist.Skip(begin).Take(pagesize).CopyToDataTable();
    It says it can not convert System.DataTable to DataSetProducts.sk_productsDataTable, however it is the same table.
    Any thoughts how to return a typed DataTable?

    I know I could iterate through all DataRows in productlist and import the rows to the typed datatable, but there must be a better / faster / more elegant way to do this?

    • Edited by kbalint Monday, May 11, 2009 8:51 PM typo
    Monday, May 11, 2009 5:41 PM