查询C#中DB的枚举值
问题描述:
我的约会数据库有Appointment ID, Status(enum type), Student
作为列值。查询C#中DB的枚举值
这是Status
枚举:
public enum StatusType
{
Pending,
Approved,
Cancelled
}
我需要查询的分贝(约会)行的列表,其中Status
列设置为'Pending'
并将它传递给一个列表变量。
如何在使用C#的Visual Studio中执行此操作?
IEnumerable<Appointment> AppQuery = from appointment in _appointmentData.GetAll()
where appointment.Status????
select appointment;
注意:_appointmentData.GetAll()
列出了数据库中的整个行。
答
要看什么获取存储在数据库中有点,但对于使用.Equals
:
IEnumerable<Appointment> AppQuery = from appointment in _appointmentData.GetAll()
where appointment.Status.Equals(StatusType.Pending)
select appointment;
+0
非常感谢。这工作! – re3el
你试过'那里appointment.Status == StatusType.Pending' – mariocatch
是什么状态在你的数据类型数据库? – Sherlock