views:

28

answers:

2

i want to use Linq's Iquerable that gives me the ' query that gets only the records needed to the page' based on the Page size i have given.

i have used this:

System.Linq.IQueryable<DataTable> ds = 
    (from m in dttableDetails.TableName select m).Take(page_size).Skip(offset);

but it is showing me error. i need the returned type as 'Datatable/Dataset'

how to do this... pls help

error as:

Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<char>' to 'System.Linq.IQueryable<System.Data.DataTable>'. An explicit conversion exists (are you missing a cast?)
+1  A: 

dttableDetails.TableName returns the name of the table, so from m in dttableDetails.TableName select m returns an enumerable which iterates over the characters in the string, hence you get an IEnumerable<char>

Try

var results = (from m in dttableDetails select m).Take(page_size)
Winston Smith
A: 

This might help c-sharp corner

SubPortal