Board index » delphi » Default TDatabase Params

Default TDatabase Params

Is there a way to create a TDatabase in code and then obtain a list of the
default params for that database like you can by double-clicking on a
TDatabase object and setting it up manually?

I am trying to recreate the functionality of the TDatabase component for the
end-user such that they can select a database to use and then have a listbox
populated with the default paramaters.

Any thoughts will be sincerely appreciated!

Mark A. Deal
Document & Data Solutions, LLC
http://www.docsol.com

 

Re:Default TDatabase Params


"Mark A. Deal" <nos...@docsol.com>

Quote
> Is there a way to create a TDatabase in code and then obtain a list of the
> default params for that database like you can by double-clicking on a
> TDatabase object and setting it up manually?

> I am trying to recreate the functionality of the TDatabase component for
the
> end-user such that they can select a database to use and then have a
listbox
> populated with the default paramaters.

Lookup the TSession method, GetAliasParams in online Help. Here is the
sample code.

uses
  DBTables;

procedure ParamsFromAlias(const AliasName: string; Params: TStrings);
begin
  Params.Clear;
  DBTables.Session.GetAliasParams(AliasName, Params);
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  ParamsFromAlias(ComboBox1.Items[ComboBox1.ItemIndex], ListBox1.Items);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  Session.GetAliasNames(ComboBox1.Items);
end;

end.

-- Reddy.

Other Threads