【发布时间】:2016-02-11 04:02:12
【问题描述】:
我的程序正在像这样从 SQL Server 读取数据:
if (!reader.IsDBNull(4))
{
message.WazneDo = reader.GetDateTime(4);
}
此代码从 SQL Server 读取日期时间。然后我将它加载到datagridview:
WypozyczZwrocDb _dost1 = new WypozyczZwrocDb();
Global.listWypozyczZwroc = _dost1.PokazZar();
Global.fMain.Tabela.DataSource = Global.listWypozyczZwroc;
如何与今天的日期比较?我想改变行颜色。
我试过了:
DateTime dzis = DateTime.Now;
if(Tabela.Rows[Tabela.CurrentCell.RowIndex].Cells[4].Value > dzis)
if(Tabela.Rows[Tabela.CurrentCell.RowIndex].Cells[4].Value > dzis.ToString())
【问题讨论】:
标签: c# sql-server datetime datagridview compare