我正在查询数据库并将值分配给我序列化并在报告中显示的对象。
事情是布尔变量在报告中显示为真或假。如何使值显示为“是”或“否”。
这是我的课
public class ProductReportView
{
public int Count { get; set; }
public string ProductCode { get; set; }
public string ProductTitle { get; set; }
public string Producer { get; set; }
public bool VideoOnDemand { get; set; }
public bool PreviewScreen { get; set; }
public bool QualityCheck { get; set; }
public bool Archive { get; set; }
}
这就是我分配值的方式
OleDbDataReader dbreader = cmd.ExecuteReader();
while (dbreader.Read())
{
Console.WriteLine("Record " + totalCount++);
ProductReportView rep = new ProductReportView();
rep.Count = ++totalCount;
rep.ProductCode = (string)dbreader["CODE"];
rep.ProductTitle = (string)dbreader["TITLE"];
rep.Producer = (string)dbreader["PRODUCER"];
rep.VideoOnDemand = (bool)dbreader["VideoOnDemand"];
rep.PreviewScreen = (bool)dbreader["PreviewLibraryChecked"];
rep.QualityCheck = (bool)dbreader["QualityCheck"];
rep.Archive = (bool)dbreader["Archive"];
lst.Add(rep);
}
这些值基于选中和未选中的复选框(VideoOnDemand、PreviewScreen QualityCheck、Archive)