【发布时间】:2016-08-05 02:26:20
【问题描述】:
我的约会数据库有Appointment ID, Status(enum type), Student 作为列值。
这是Status 枚举:
public enum StatusType
{
Pending,
Approved,
Cancelled
}
我需要查询 db(appointments) 中 Status 列设置为 'Pending' 的行列表,并将其传递给列表变量。
如何在 Visual Studio 中使用 C# 做到这一点?
IEnumerable<Appointment> AppQuery = from appointment in _appointmentData.GetAll()
where appointment.Status????
select appointment;
注意:_appointmentData.GetAll() 列出了数据库中的所有行。
【问题讨论】:
-
你试过
where appointment.Status == StatusType.Pending -
你的数据库中status的数据类型是什么?