第一个问题,把ComboBox的Style属性设置为csDropDownList

解决方案 »

  1.   

    第二个问题要自己写代码实现,在Edit的事件中加入查询数据库的代码
      

  2.   

    1、把ComboBox的Style属性设置为csDropDownList
    2、sql语句中用like
      

  3.   

    100分啊,呵呵,真不错;
    NO.1:
    ComboBox.Style := csDropDownList;
    NO.2:
    Edit1.Change事件里
    if Not Query.Locate('xz','xx',[]) then
    begin
      Application.Message(......);
      Edit1.Clear;
      Edit1.SetFocus;
    end;
      

  4.   

    ComboBox.Style := csDropDownList;Edit1.Change事件里
    Query1.SQL.Add('select xx from mytable where yy like "%'+Edit1.Text+'%');
      

  5.   

    楼上的,如果要这样的话,每次都要打开数据集,再关闭数据集才行的;
    如:
    with Query do
    beign
      Close;
      SQL.Clear;
      SQl.Add('select xx from mytable where yy like "%'+Edit1.Text+'%');
      Open;
      if Record.Count=0 then//如果是SQL Server的话,有则为-1
      begin
        Application.Message(......);
        Edit1.Clear;
        Edit1.SetFocus; 
      end;
    end;
      

  6.   

    在Edit1.Change事件里:
    with Query1 do
    beign
      Close;
      SQL.Clear;
      SQl.Add('select * from table1 where 字段名                        like ''%'+Edit1.Text+'%''');
      Open;