Using SQLOLEDB in c# or wpf Devexpress

116 Views Asked by At

just run into https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0ff7f210-7697-431b-9e6b-0f2e10f4c031/sql-2016-slow-connection-using-server-name-fast-using-127001?forum=sqlsetupandupgrade.

Is it possible to simply bypasse .net in a c# program and simply have this kind of performance ?

Is this is juste a change in the connection in order to use this provider, or its something more complexe ?

Success: Provider=SQLOLEDB;Data Source=::1;Integrated Security=SSPI Elapsed: 00:00:00.0015378

Here is how we do it now: SqlCommand command = new SqlCommand(queryString, connection); connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            // Call Read before accessing data.
            while (reader.Read())
            {
              ...
            }

            // Call Close when done reading.
            reader.Close();

Here is the connection string: Server=...;Database=...;Uid=...;Pwd=...;Encrypt=True;TrustServerCertificate = true;Asynchronous Processing=true;MultipleActiveResultSets=True

1

There are 1 best solutions below

0
On

That thread is from a user having slow connection times to local SQL Server using .NET's SqlClient, but I couldn't reproduce it.

Are you having some sort of actual problem?

And no, you can't use SqlClient with an OleDB provider or ODBC driver. There are different ADO.NET providers for those. And SQLOLEDB is deprecated, so SqlClient is the only modern, supported SQL Server connection stack that ships as part of Windows.