加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 无法将类型’System.Linq.IQueryable’转换为’int’

发布时间:2020-12-15 18:32:16 所属栏目:百科 来源:网络整理
导读:我在将数据从数据库发送到Controller中的列表时遇到问题.我是C#和MVC的新手,所以任何帮助都会有用!代码如下 public static ListFilterTree GetAllUsers() { FilterTreeDBContext db = new FilterTreeDBContext(); var userList = new ListFilterTree(); var
我在将数据从数据库发送到Controller中的列表时遇到问题.我是C#和MVC的新手,所以任何帮助都会有用!代码如下
public static List<FilterTree> GetAllUsers()
    {
        FilterTreeDBContext db = new FilterTreeDBContext();
        var userList = new List<FilterTree>();
        var device =  new FilterTree();
        //This is the line where I get the error
        device.ID = from a in db.FilterTree select a.ID;

        userList.Add(device);
        return userList;
    }

谢谢&节日快乐!!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读