How to detect current provider and client version?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kknyazev
Posts: 2
Joined: Thu 21 Jan 2021 14:50

How to detect current provider and client version?

Post by kknyazev » Fri 22 Jan 2021 08:50

Hello!
If i set TMSConnection.Options.Provider = prAuto and NativeClientVersion = ncAuto, is it possible to get actual values of used provider and native client version?
Thanks!

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: How to detect current provider and client version?

Post by Stellar » Mon 25 Jan 2021 09:15

To get the client and server version, you can use the following example:

Code: Select all

uses
  MSClasses;

procedure TForm1.Button1Click(Sender: TObject);
var
  St: String;
  MSSQLConnection: TMSSQLConnection;
begin
  MSSQLConnection := TMSSQLConnection(TDBAccessUtils.GetIConnection(MSConnection));

  if MSConnection.Connected then begin
    St := MSSQLConnection.GetServerVersionFull;
    if st <> ':' then
      Memo1.Lines.Add(St);
  end;
  if (MSConnection.Options.Provider <> prCompact) and
     (MSConnection.Options.Provider <> prDirect)
  then begin
    St := MSSQLConnection.GetClientVersionFull + ': ' + MSSQLConnection.GetClientVersion;
    if St <> ': ' then
      Memo1.Lines.Add(St);
  end;
end;

kknyazev
Posts: 2
Joined: Thu 21 Jan 2021 14:50

Re: How to detect current provider and client version?

Post by kknyazev » Mon 25 Jan 2021 11:15

Thank you!

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: How to detect current provider and client version?

Post by Stellar » Tue 26 Jan 2021 06:44

Glad to see that the issue was resolved.
Feel free to contact us if you have any further questions about our products.

Post Reply