MS sql connect with win login username and password lazarus / 16-Databases ---------------------------------------------------------------------- SteenJorgensen · 2019-02-26 08:10 I want to connect to my mssql server using the windows login. For now i have a code that read all data to the connections component from a ini file like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SQLDBLibraryLoader1.Enabled   := True;MSSQLConnection1.HostName     := INI.ReadString('DB', 'Host', '');MSSQLConnection1.DatabaseName := INI.ReadString('DB', 'Databasename', '');MSSQLConnection1.UserName := INI.ReadString('DB', 'Database user name', '') ; //Need win userMSSQLConnection1.Password := INI.ReadString('DB', 'Database password', '') ;    //Need win password     This works fine BUT i want to use the windows login username and password. Do any have a solutions for this? ---------------------------------------------------------------------- rvk · 2019-02-26 08:54 Do you want to connect to the MSSQL server with your own Windows credentials? In that case you should just set Username and Password to empty. You can see and test that with the example in lazarus/examples/mssql. It has a checkbox in the loginform for OSAuthentication. If you want to use a different user then you'll need to impersonate that user. I haven't seen it done in Lazarus but you can check out some Delphi code here: https://stackoverflow.com/a/1847035/1037511 ---------------------------------------------------------------------- SteenJorgensen · 2019-02-26 10:56 Thanks. This help. Now this works.