0
bsCheckVoucherGridView.Filter =
string.Format("[CHECK DATE] >= #{0:M/dd/yyyy}# ",
dateTimePicker_CheckVoucher_SearchCheckVoucherDate.Value);
dateTimePicker_CheckVoucher_SearchCheckVoucherDate.Value = DateTime.Now.AddYears(-1);
dateTimePicker_CheckVoucher_SearchCheckVoucherDate.Format = DateTimePickerFormat.Short;
bsCheckVoucherGridView.DataSource =
db.GetDataTable("SELECT `CHECK_DATE` AS `CHECK DATE` FROM check_voucher");
bsCheckVoucherGridView.Filter =
string.Format("[CHECK DATE] >= {0:M/dd/yyyy} ",
dateTimePicker_CheckVoucher_SearchCheckVoucherDate.Value);
上面的代碼在System.DateTime和System.Double上發生「Can not perform」> ='操作錯誤。在BindingSource中過濾DateTimePicker的日期值
我要回答我的問題。
bsCheckVoucherGridView.Filter =
string.Format("[CHECK DATE] >= #{0}# ",
dateTimePicker_CheckVoucher_SearchCheckVoucherDate.Value.ToString("dd-MMM-yyyy"));
這很好用!