2013-12-20 45 views
0

這不起作用bindingsource.filter不工作

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'"; 

找不出什麼問題

回答

0

如果你的過濾器接受日期格式dd/MM/yyyy h:mm tt格式你不需要提供秒(ss

T ry此:

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