0
我想從一個名爲「Customer」的表中選擇一些行,但是當我使用「db.Customer」定義tableName時,它似乎是錯誤的。有什麼辦法可以做到嗎?如何在LINQ to ENTITIES select語句中使用變量?
string tableName = "db.Customer";
var result = from p in tableName
select new
{
ID = p.ID,
Des = p.Description,
type = p.Type,
date = p.DateCreated
};
gridview.DataSource = result;
gridview.DataBind();