Click here to Skip to main content
15,911,711 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,
i written the a method which will returs the data from the table
below is the code :
XML
public static List<emp> fillgrid()
    {

        testingEntities TE=new testingEntities();
        var query= from e in TE.emps
                   select e;
        return query.ToList();

    }



i need to table name as parameter so that same logic will be reused to other tables also
how can i do this process


Thanks Inadvance
Posted
Updated 20-Apr-12 1:35am
v2
Comments
Karthik Harve 20-Apr-12 7:41am    
I dont think you can have a general entity type in LINQ.

1 solution

Hello

You can build a Dynamic LINQ using expression trees.
Please look at: How to: Use Expression Trees to Build Dynamic Queries (C# and Visual Basic)
 
Share this answer
 
Comments
VJ Reddy 23-Apr-12 22:41pm    
Good reference. 5!
Shahin Khorshidnia 24-Apr-12 6:42am    
Thanks again VJ :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900