DataContext.GetTable(Type type)var result from obj in context.Planwhere obj.menuId int.Parse(m
DataContext.GetTable(Type type)
var result = from obj in context.Plan where obj.menuId == int.Parse(menuId) select obj; this.lvDetail.DataSource = result; this.lvDetail.DataBind();
以上这段代码等于是读的Plan表,但是我现在想根据一个tableName的string动态的决定是从哪个表中读数据请问该如何实现,是不是能用DataContext.GetTable(Type type)方法,但是这个方法出来的是ITable,那我在写where子句时表中的字段就点不出了,请问这有什么办法解决? [解决办法] var result = from obj in context.Plan where obj.menuId == int.Parse(menuId) select obj; this.lvDetail.DataSource = result; this.lvDetail.DataBind();
var result = from obj in context.Plan where obj.menuId == int.Parse(menuId) select obj; this.lvDetail.ItemTemplate = LoadTemplate("~/Template_Plan.ascx"); this.lvDetail.DataSource = result; this.lvDetail.DataBind();
tableName是"Market"
var result = from obj in context.Market where obj.menuId == int.Parse(menuId) select obj;