我有一个存储过程,我在其实体框架模型中作为函数导入。我想将存储过程的一个值分配给我的label.text,但它不会出现在intellisense中。我一定做错了什么。有人可以帮忙吗?
private void GetBackgroundData()
{
List<GetBackground_Result> results = context.GetBackground().ToList();
lblFullName.Text = results.FullName // FullName doesn't appear in my intellisense
}
答案 0 :(得分: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;