如何使数据库表某一字段的内容显示在文本框和mome控件里?

解决方案 »

  1.   

    with adoquery1 do
    try
      close;
      sql.clear;
      sql.add('select * from tablename');
      prepared;
      open;
      if not isempty then
       begin
          first;
          while not eof do
           begin
             memo1.lines.add(fields[0].asstring);
             next;
           end;  
       end;
    except
       showmessage('false');
       exit;
    end;
      

  2.   

    with ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select 某一字段 from 表名');
      Open;
      First;
      if ADOQuery1.RecordCount>0 then
        while not Eof then
        begin
          Memo1.Lines.ADD(FieldByName('某一字段').asstring);
          Next;
        end;
    end;