[求助]DateTime
我用了两个日期控件,作为查询的条件我用的是组合查询,
DateTime Begin = DateTime.Parse("1900-1-1");
DateTime end = DateTime.Parse("1900-1-1");
if (clb_Begin.Text.Trim().ToString() != null)
{
Begin = DateTime.Parse(clb_Begin.Text.Trim().ToString());
}
if (clb_End.Text.Trim().ToString() != null)
{
end = DateTime.Parse(clb_End.Text.Trim().ToString());
}
我这样写这行代码始终要抱错,当我不选择日期时
Begin = DateTime.Parse(clb_Begin.Text.Trim().ToString());
错误:
String was not recognized as a valid DateTime.
请问当不选择时该怎么判断