我想检查datetimepicker日期是否等于数据库中表中的日期,如果条件允许,请给出答案 [英] i want to check datetimepicker date equal to date inside the table in database using if condition is it possible then please give the answer for it
本文介绍了我想检查datetimepicker日期是否等于数据库中表中的日期,如果条件允许,请给出答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用条件是否可能检查等于数据库表中日期的datetimepicker日期,请提供答案.
i want to check datetimepicker date equal to date inside the table in database using if condition is it possible then please give the answer for it
推荐答案
br/>
尝试这样.
Hi,
try like this.
//dt is datatable which is having DB values.
DateTime selDate = ddtTimePic.SelectedDate;
DateTime DBDate = Convert.ToDateTime(dt.Rows[0]["Date"].ToString());
if(selDate > DBDate)
{
MessageBox.Show("Selected Date is greater than DB Date");
}
else if(selDate == DBDate)
{
MessageBox.Show("Selected Date is equal to DB Date");
}
else
{
MessageBox.Show("Selected Date is less than DB Date");
}
希望对您有所帮助.
hope it helps.
这篇关于我想检查datetimepicker日期是否等于数据库中表中的日期,如果条件允许,请给出答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文