bindingsource.filter不工作

时间:2013-12-20 17:47:58

标签: c# sql binding

这不起作用

string d = InvDate.ToString("dd/MM/yyyy h:mm:ss tt",CultureInfo.InvariantCulture).Trim();
            sale_invoiceBindingSource.Filter = "InvDate = '"+d+"'";

但这有效

string d = InvDate.ToString("dd/MM/yyyy h:mm:ss tt",CultureInfo.InvariantCulture).Trim();
            sale_invoiceBindingSource.Filter = "InvDate = '20/12/2013 10:45 PM'";

无法弄清楚问题是什么

1 个答案:

答案 0 :(得分:0)

如果您的过滤器接受dd/MM/yyyy h:mm tt格式的日期格式,则无需提供秒(ss

试试这个:

string d = InvDate.ToString("dd/MM/yyyy h:mm tt",CultureInfo.InvariantCulture).Trim();
sale_invoiceBindingSource.Filter = "InvDate = '"+d+"'";