这条过滤语名如何写
1) string strRowFilter = " ";
2) strRowFilter = "(姓名 like '% " + txt1.Text.Trim() + "% ') and 日期 like '% " +txt2.Text.Trim() + "% ') ";
3) tempTable.DefaultView.RowFilter = strRowFilter;
由于[日期]是一个整形值而不能使用[%]
问怎样把[日期]转换为字符形
------解决方案--------------------你原来写的括号不对,下面两种都可以:
strRowFilter = "(姓名 like '% " + txt1.Text.Trim() + "% ') and (日期 like '% " +txt2.Text.Trim() + "% ') ";
strRowFilter = "姓名 like '% " + txt1.Text.Trim() + "% ' and 日期 like '% " +txt2.Text.Trim() + "% ' ";
------解决方案--------------------strRowFilter = "姓名 like '% " + txt1.Text.Trim() + "% ' and 日期 like '% " +txt2.Text.Trim() + "% ' ";
------解决方案--------------------CONVERT(INT, txt2.Text.Trim())试试