我遇到了这个错误:“无法将lambda表达式转换为类型'string',因为它不是委托类型” - 关键字select会被下划线标记为蓝色。请问您有什么建议?
以上代码应该在组合框中显示员工名字和姓氏的下拉列表。
Employee emp = new Employee();
comHandledBySQt.DataSource = from x in emp.GetDataFromTable("1")
select new { x.Id, Name = x.FirstName + " " + x.LastName };
comHandledBySQt.DisplayMember = "Name";
comHandledBySQt.ValueMember = "Id";
以上代码应该在组合框中显示员工名字和姓氏的下拉列表。