高手请教,我的程序在FormShow中的执行,我需要根据ComboBox1的Text变化选择查询显示相应的数据值可是只能显示一条在变换ComboBox1的Text的内容,其他的Edit.text没有任何变化!!郁闷!!!!谢谢指教!!!vara : string;
begin
    Edit9.Text := Form1.ComboBox1.Text;
    DS := TSQLDataset.Create(nil);
    DS.SQLConnection := SQLConnection1;
    DS.CommandType := ctQuery;
    DS.CommandText :='select * from cpdj';
  try
    DS.Open;
    while not DS.Eof  do
    begin
      ComboBox1.Items.Add(DS.FieldByName('cname').AsString);
      ComboBox1.ItemIndex := 0;
      DS.Next;
      end;
    begin
       a := ComboBox1.Text;
       DS := TSQLDataset.Create(nil);
       DS.SQLConnection := SQLConnection1;
       DS.CommandType := ctQuery;
       DS.CommandText :='select cid from cpdj where cname='+quotedstr(a)+'';
       DS.Open;
      while not DS.Eof  do
       begin
       edit2.Text :=DS.FieldByName('cid').AsString ;
       ds.Next;
       end;
        DS.Close;
        DS.CommandText :='select clx from cpdj where cname='+quotedstr(a)+'';
        DS.Open;
        while not DS.Eof  do
        begin
        edit3.Text :=DS.FieldByName('clx').AsString ;
        ds.Next;
        end;
       DS.Close;
       DS.CommandText :='select cxh from cpdj where cname='+quotedstr(a)+'';
       DS.Open;
       while not DS.Eof  do
       begin
       edit4.Text :=DS.FieldByName('cxh').AsString ;
       ds.Next;
       end;
       DS.Close;
       DS.CommandText :='select ghsname from cpdj where cname='+quotedstr(a)+'';
       DS.Open;
       while not DS.Eof  do
       begin
       edit4.Text :=DS.FieldByName('ghsname').AsString ;
       end;
       end;
     finally
    DS.Free;  //当数据库操作完成后释放。
  end;
  begin
  self.DateTimePicker1.datetime :=now;
  end;
end;