//方法中的代码var userInfoList = from p in db.UserInfo select new {UserID=p.ID, UserName = p.UName, UserPwd = p.UPwd };
//view中的代码@foreach (var userinfo in (IQueryable<object>)ViewData["userInfoList"]) { <tr> <td>@userinfo.GetType().GetProperty("UserID").GetValue(userinfo)</td> </tr> }
时间: 2024-10-11 01:02:06