嗨,我只是想在 sql 中做到这一点
SELECT ID,Name
FROM Countrys
UNION all
SELECT '00000000-0000-0000-0000-000000000000','All' Name
ORDER BY Id
将它与组合框上的“ALL”选项一起使用
using (GezentiEntities GE = new GezentiEntities())
{
string[,] str = new string [1,2]{ {"00000000-0000-0000-0000-000000000000", "All"} };
var obj = str.Cast<object>().ToArray();
var countries = (from c in GE.Countrys select new { c.Id, c.Name })
.Concat
(from s in obj select s);
cmbNationality.DataSource = countries.ToList();
cmbNationality.ValueMember = "Id";
cmbNationality.DisplayMember = "Name";
}
它给了我这个错误:
无法创建“System.Object”类型的常量值。此上下文仅支持原始类型或枚举类型。