[英]Query enum value from DB in C#
我的約會數據庫具有Appointment ID, Status(enum type), Student
作為列值。
這是Status
枚舉:
public enum StatusType
{
Pending,
Approved,
Cancelled
}
我需要查詢Status
列設置為'Pending'
的db(約會)中的行列表,並將其傳遞給列表變量。
如何在Visual Studio中使用C#做到這一點?
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;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.