Page 1 of 1

How to detect current provider and client version?

Posted: Fri 22 Jan 2021 08:50
by kknyazev
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!

Re: How to detect current provider and client version?

Posted: Mon 25 Jan 2021 09:15
by Stellar
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;

Re: How to detect current provider and client version?

Posted: Mon 25 Jan 2021 11:15
by kknyazev
Thank you!

Re: How to detect current provider and client version?

Posted: Tue 26 Jan 2021 06:44
by Stellar
Glad to see that the issue was resolved.
Feel free to contact us if you have any further questions about our products.