怎么样通过单击listBox中的任一项,来从数据库里查找相应的内容
我想通过单击不同的选项,在数据里查出响应的内容
应该如何来实现
谢谢

解决方案 »

  1.   

    这个简单呀:
    with Query do
    begin
      Close;
      SQL.Text:='Select * from t where name='''+NameListBox.Items[NameListBox.ItenIndex]+'''';
      Open;
    end;
      

  2.   

    当然记着把这类似的代码放在ListBox的OnClick事件中即可.
      

  3.   

    var
    s:string;
    i:integer;
    begin
      i := listbox1.ItemIndex;
      s := listbox1.Items[i];
      adoquery1.Close;
      adoquery1.SQL.Clear;
      adoquery1.SQL.Add('select *  from table1 where name='''+ s + '''' );
      adoquery1.open;