Login to sqlserver

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Moondancer
Posts: 9
Joined: Tue 10 Apr 2012 14:07

Login to sqlserver

Post by Moondancer » Sat 12 Jul 2014 23:45

To login I use UniConnectDialog1. How can I pass the name of the user and the name of the database to which the user just logged (if login was successful) to statusbar panel text (1,2)?

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Login to sqlserver

Post by azyk » Tue 15 Jul 2014 14:26

You can retrieve user name and database name on successful logging in in the TUniConnection.AfterConnect event. For example:

Code: Select all

procedure TForm1.UniConnectionAfterConnect(Sender: TObject);
begin
  StatusBar.Panels[1].Text := UniConnectDialog1.Connection.Database;
  StatusBar.Panels[2].Text := UniConnectDialog1.Connection.Username;
end;

Post Reply