Improve SQL Server Connection Performance In ADO.NET

Recently, I was using ADO.NET to connect to an SQL Server database on a local network. I noticed that the connection speed seemed off. It was slow. I did some research and googled it and found one property in ADO.NET connection string that can help improve the performance of our database connection, i.e., the "Network Library=DBNMPNTW;' 
 
This loads a DLL protocol that enhances the speed to the connection on a local network. In my case, we had a 100MB internet connection and the performance improved close to 50 percent.
 
Actual C# code
  1. public static SqlConnection GetConnection(in string cStrConn)  
  2.        {  
  3.            try  
  4.            {  
  5.                var oSql = new SqlConnection(cStrConn);  
  6.                oSql.Open();  // HIGH DELAY
  7.                return oSql;  
  8.            }  
  9.            catch  
  10.            {  
  11.                return null;  
  12.            }  
  13.        }  
Sample connection
  1. Network Library=DBNMPNTW;Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;  
  2. Password=myPassword;  
Fixed open
  1. public static SqlConnection GetConnection(in string cStrConn)  
  2.         {  
  3.             try  
  4.             {  
  5.                 var oSql = new SqlConnection($"Network Library=DBNMPNTW;{cStrConn}");  
  6.                 oSql.Open();  
  7.                 return oSql;  
  8.             }  
  9.             catch  
  10.             {  
  11.                 return null;  
  12.             }  
  13.         }  
A sample of how to use it:
  1. try    
  2.       {    
  3.   
  4.           using (var oCnn = ConfiguracoesDBT.GetConnection("Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername; Password=myPassword;  "))    
  5.           {    
  6.               if (oCnn is null) yield break;    
  7.               ds = ConfiguracoesDBT.GetDataTable(cSql.ToString(), oCnn);    
  8.           }    
  9.       }    
  10.       catch { yield break; }    
The network library is the real magic. It handles the communication with SQL Server instance and makes it faster.
 
See more information here.
 
Info about the library can be seen here - https://www.win7dll.info/dbnmpntw_dll.html 
 
Conclusion
 
This DLL protocol makes the database connection faster (in my case, 50 percent faster).
 
CAUTION
 
Use it only on a local network. This is not recommended for Web apps or remote databases.