0

Hi when I try to connect to a Microsoft SQL Server 2008R2 using System.Data.SqlClient from a Windows Universal Platform App I get following exception:

System.Data.SqlClient.SqlException: 'A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The operation completed successfully)'

This is my connection string, I'm using SQL Authentification:

string connectionString = "{Data Source=xxx.xxx.xxx.xxx; Initial Catalog=TheDatabase;Integrated Security=false;User ID=user;Password=Password}"

When I try to connect to a 2016 SQL Server everithing works, here is my code:

using (SqlConnection connection= new SqlConnection(connectionString))
    {
        connection.Open();
    }

The exception is been thrown at connection.Open()

Things to consider:

  • I've already set all needed premission in the Package.appxmanifest (enterpriseAuthentication, privateNetworkClientServer)
  • The SQL server has both Windows and SQL Authentification and has TCP enabled
  • The target version of the package is Windows 10 Fall Creators Update(10.0; Bulid 16299)
  • I already tried Integrated Security = true, and the exception is the same
  • Other applications (non WUP) are working fine with the 2008R2 Server and are also C# apps with .NET

This thread explanes the same issue: link to the question

Could Service Pack 3 for SQL Server 2008R2 help?

Are there workarounds or better ways to make 2008R2 work with WUP?

  • There are so many possible causes of this error that I sort of despair. [This page](https://www.codeproject.com/Questions/356619/A-connection-was-successfully-established-with-the) includes eight different options, and I saw at least a half-dozen more. You mentioned checking that TCP/IP was enabled, but did you check that the SQL Browser Service was enabled and active? – Laughing Vergil Jun 28 '18 at 17:12
  • I checked, it's enabled :) – Manuel Roat Jun 28 '18 at 17:17

1 Answers1

0

Installing 2008R2 Service Pack solved the issue. I tried to reproduce the problem on my local pc with 2008R2 Express. I reproduced the issue and after I did the update to 2008R2 Service Pack 2 Express everything worked flawlessly.

I'll install the Service Pack 3 on production and update you if it's working