我正在查詢數據庫並將值分配給一個對象,我將其序列化並顯示在報告中。將bool值顯示爲Yes或No
事情是布爾變量在報告中顯示爲真或假。如何讓值顯示爲「是」或「否」。
這是我的課
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,歸檔)
複選框值
重複的http://stackoverflow.com/questions/5632920/how-to-generically-format-a-boolean-to-a-yes-no-string - 看看 – Anthill 2013-02-12 10:45:49
'顯示在報告中'哪裏如何? – 2013-02-12 10:46:44