How to execute LINQ query when I have the table`s name stored in a variable
-
want to do execute a LINQ query, and I have the name of the table to query stored in a variable: string tableName = "SomeTable""; DataContext db = new DataContext(); var vResult = from t in db.tableName where t.Id = ....
You can use Reflection for such scenario. Find following link useful for the same. http://stackoverflow.com/questions/3374133/how-to-execute-linq-query-when-i-have-the-tables-name-stored-in-a-variable Hope this help!
Peace ON In Simple Sense... Start Shining Stories We Live...
-
You can use Reflection for such scenario. Find following link useful for the same. http://stackoverflow.com/questions/3374133/how-to-execute-linq-query-when-i-have-the-tables-name-stored-in-a-variable Hope this help!
Peace ON In Simple Sense... Start Shining Stories We Live...
You do realize you have pointed to the same question, the code given my the OP is the same, and gave the same useless answer, Use reflection, with no elaboration.
Failure is not an option; it's the default selection.
-
want to do execute a LINQ query, and I have the name of the table to query stored in a variable: string tableName = "SomeTable""; DataContext db = new DataContext(); var vResult = from t in db.tableName where t.Id = ....