用delphiXE7 dbExpress Framework提供的功能获取数据表信息

时间:2023-03-08 15:41:14
用delphiXE7 dbExpress Framework提供的功能获取数据表信息

uses +  Data.DBXMetaDataNames

procedure TMainForm.Button2Click(Sender: TObject);
var
  Cmd: TDBXCommand;
  R: TDBXReader;
begin
  DBCon.Open;
  Cmd := DBCon.DBXConnection.CreateCommand;
  Cmd.CommandType := TDBXCommandTypes.DbxMetaData;
  Cmd.Text := TDBXMetaDataCommands.GetColumns + ' ' + 'SysFields';
  R := Cmd.ExecuteQuery;
  while R.Next do
  begin
    if R.Value[TDBXColumnsColumns.IsAutoIncrement].AsBoolean then
      Memo1.Lines.Add(R.Value['ColumnName'].AsString);
  end;
  R.Free;
  Cmd.Free;
end;

dbExpress Framework 很好用啊! 为啥搞个FireDAC?! 哎!