-
Microsoft.Data.SqlClient is slower than OdbcConnection for some parameterized queries. i write the same statement in C# Code. This is the query generated by Microsoft.Data.SqlClient that I captured using SQL Profiler: This is the query generated by OdbcConnection The results show that Microsoft.Data.SqlClient takes about 60 ms, while OdbcConnection takes about 10 ms. I also tried using Dapper, but the result is the same as SqlClient. From my observation.I found that the performance difference only occurs when inserting into a temp table with a condition. There is no difference in simple query statements. Is there any way to make a Microsoft.Data.SqlClient query faster, like with an ODBC driver? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found thati it was because MultipleActiveResultSets=True in my connection string in App that connect with Microsoft.Data.SqlClient. I tried removing it, and now they take the same amount of time. |
Beta Was this translation helpful? Give feedback.
I found thati it was because MultipleActiveResultSets=True in my connection string in App that connect with Microsoft.Data.SqlClient. I tried removing it, and now they take the same amount of time.