I want to get the connection string so I can use it in my c# app. I checked out other threads in here, but they were old and toolbar sections were different.
Any help would be appreciated.
I want to get the connection string so I can use it in my c# app. I checked out other threads in here, but they were old and toolbar sections were different.
Any help would be appreciated.
SELECT
'data source=' + @@SERVERNAME +
';initial catalog=' + DB_NAME() +
CASE type_desc
WHEN 'WINDOWS_LOGIN'
THEN ';trusted_connection=true'
ELSE
';user id=' + SUSER_NAME()
END
FROM sys.server_principals
WHERE name = suser_name()