希望通过Filter属性进行过滤
BindingSource.Filter = "%p"; //ok
BindingSource.Filter = "%p%"; //ok
BindingSource.Filter = "%p%c%"; //wrong,提示表达式错误
如果希望进行第三种方式的模糊查询,应该怎么办?
BindingSource.Filter = "%p"; //ok
BindingSource.Filter = "%p%"; //ok
BindingSource.Filter = "%p%c%"; //wrong,提示表达式错误
如果希望进行第三种方式的模糊查询,应该怎么办?
解决方案 »
- DataView类rowFilter属性的问题
- Control.ControCollection Con,是什么意思呢?
- 请问如何实现像CSDN提问问题标题的智能匹配?
- 急求 文件读取 base64编码转换问题
- 谁知道YYYY/MM/DD 格式的 输入 怎么验证(check) 阿,快 下班了马上结贴
- 高分求解智能客户端(Issuevision)问题!高手帮忙!!!!!!
- 请问如何正确杀掉线程,而不引发异常?
- 无法将类型“System.EventHandler”隐式转换为“System.Web.UI.ImageClickEventHandler”
- Visual Studio中使用va 高亮当前行没反应
- 迭代器
- 水晶报表中form动态绑定数据源问题
- C#如何解析json中的键值对?
是 bindingsource 照看的底层数据源实现的, bindingsource 只负责传递.
你的可能是 DataTable,你用 bindingsource 管理一个 List 数据源试试, 连基本的过滤都不支持.如果 DataTable 的过滤不够用, 你需要写自己的数据源.
实现众多接口.
internal string AnalizePattern(string pat)
{
int length = pat.Length;
char[] destination = new char[length + 1];
pat.CopyTo(0, destination, 0, length);
destination[length] = '\0';
string str = null;
char[] chArray2 = new char[length + 1];
int num3 = 0;
int num4 = 0;
int index = 0;
while (index < length)
{
if ((destination[index] == '*') || (destination[index] == '%'))
{
while (((destination[index] == '*') || (destination[index] == '%')) && (index < length))
{
index++;
}
if (((index < length) && (num3 > 0)) || (num4 >= 2))
{
throw new Exception("ExprException.InvalidPattern(pat);");
}
num4++;
}
else if (destination[index] == '[')
{
index++;
if (index >= length)
{
throw new Exception("ExprException.InvalidPattern(pat);");
}
chArray2[num3++] = destination[index++];
if (index >= length)
{
throw new Exception("ExprException.InvalidPattern(pat);");
}
if (destination[index] != ']')
{
throw new Exception("ExprException.InvalidPattern(pat);");
}
index++;
}
else
{
chArray2[num3++] = destination[index];
index++;
}
}
str = new string(chArray2, 0, num3);
if (num4 == 0)
{
kind = 4;
return str;
}
if (num3 > 0)
{
if ((destination[0] == '*') || (destination[0] == '%'))
{
if ((destination[length - 1] == '*') || (destination[length - 1] == '%'))
{
kind = 3;
return str;
}
kind = 2;
return str;
}
kind = 1;
return str;
}
kind = 5;
return str;
}