-1

我有一个存储过程,我将其作为实体框架模型中的函数导入。我想将存储过程的值之一分配给我的 label.text 但它没有出现在智能感知中。我一定做错了什么。有人可以帮忙吗?

    private void GetBackgroundData()
    {
        List<GetBackground_Result> results = context.GetBackground().ToList();
        lblFullName.Text = results.FullName  // FullName doesn't appear in my intellisense
    }
4

1 回答 1

1

results是一个列表,而不是GetBackground_Result. 您需要从集合中获取单个元素来设置文本:

// if there could be multiple elements in the list
lblFullName.Text = results.First().FullName;

// or, if there should only be one element in the list
lblFullName.Text = results.Single().FullName;
于 2012-09-28T21:17:26.847 回答