表中的部分搜索(BDE) [英] Partial Search In Table(BDE)

查看:55
本文介绍了表中的部分搜索(BDE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用悖论7创建了一个数据库。我通常进行的搜索是这样的语法:

I made a database with paradox 7. The usual search I do is a syntax like this:

Table.Filter := 'Country=' + QuotedStr(Edit.Text);

这将返回这些国家/地区字段与编辑中输入的文本相同的行。当我要搜索以 L开头的国家时,我使用以下语法:

This returns rows those country field is same as the entered text in edit. when I want to search for countries are beginning by "L" i use this syntax:

Table.Filter := 'Country=' + QuotedStr(Edit.Text + '*');

但是我如何搜索以 L结尾的字段?此语法不起作用:

But how can I search for fields those are finished with "L"? this syntax does not work:

Table.Filter := 'Country=' + QuotedStr('*' + Edit.Text  );

谢谢。

推荐答案

您可以使用 OnFilterRecord 事件可执行自定义过滤。以你的例子,也许……。像这样:

You can use the OnFilterRecord event to carry out a customized filtering. With your example, maybe sth. like this:

procedure TForm1.Table1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
var
  s: string;
begin
  Accept := False;
  if not DataSet.FieldByName('Country').IsNull then begin
    s := DataSet.FieldByName('Country').AsString;
    Accept := Copy(s, Length(s), 1) = 'L';
  end;
end;

这篇关于表中的部分搜索(BDE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆