[转]delphi中获得数据库中所有表名和表字段

http://www.wesoho.com/showlog.asp?log_id=1309

procedure TForm1.Button1Click(Sender: TObject);
begin
ADOConnection1.GetTableNames(ComboBox1.Items, False);
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.Text<>'' then
begin
ADOConnection1.GetFieldNames(ComboBox1.Text,ComboBox2.Items);
end;
end;

其实关键是两个函数,GetTableNames和GetFieldNames,定义如下:

procedure TADOConnection.GetTableNames(List: TStrings;
  SystemTables: Boolean);

procedure TADOConnection.GetFieldNames(const TableName: string;
  List: TStrings); 

你可能感兴趣的:(Borland,World,delphi,数据库,list,string)