sql:
  select a,b from c;现需要将结果a和b保存到两个TStringList中,如何做?

解决方案 »

  1.   

    table.open;
    table.first;
    while not table.eof do 
    begin
      stringlist1.append(table.fieldbyname('a').asstring);
      stringlist2.append(table.fieldbyname('b').asstring);
      table.next;
    end;
      

  2.   

    with adoquery do
    begin
      sql.add('select a,b from c');
      try
        open;    
      except
       showmessage('error');
      end;
    end;
    adoquery.first;
    while not adoquery.eof do
    begin
      stringlistA.append(adoquery.fieldbyname('a').asstring);
      stringlistB.append(adoquery.fieldbyname('b').asstring);
      adoquery.next;
    end;