Home >Database >Mysql Tutorial >类似Access查找中的记忆功能

类似Access查找中的记忆功能

WBOY
WBOYOriginal
2016-06-07 15:17:11969browse

procedure TComLocateFrm.LocateBtnClick(Sender: TObject); var setLoOptions : TLocateOptions; i : integer; slKeys : TStrings; begin if ComboBox1.Items.IndexOf(ComboBox1.Text)0 then try slKeys := TStringList.Create; slKeys.AddStrings(ComboBox


procedure TComLocateFrm.LocateBtnClick(Sender: TObject);
var
   setLoOptions : TLocateOptions;
   i : integer;
   slKeys : TStrings;
begin


  if ComboBox1.Items.IndexOf(ComboBox1.Text)  try
    slKeys := TStringList.Create;
    slKeys.AddStrings(ComboBox1.Items);
    ComboBox1.Items.Clear;
    ComboBox1.Items.Add(ComboBox1.Text);
    for i := 0 to 8 do
      if i         ComboBox1.Items.Add(slKeys.Strings[i]);
  finally
     slKeys.Free;
  end
  else begin
    i := ComboBox1.Items.IndexOf(ComboBox1.Text);
    ComboBox1.Items.Insert(0,ComboBox1.Text);
    ComboBox1.Items.Delete(i+1);
    ComboBox1.ItemIndex := 0;
  end;

  if rdoExactly.Checked then
     setLoOptions := []
  else
     setLoOptions := [loPartialKey];
  if Not DesDataSet.Locate('ZTM', ComboBox1.Text, setLoOptions) then
     MessageBox(Handle, '没有找到符合条件的记录。', '提示', 0+64);
end;

 

本文作者:

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn