title: Cannot connect to SQL Server 2019 using new MSOLEDBSQL
body: <p>I am converting my application to use MSOLEDBSQL from SQL Server Native Client 11.0</p>
  
  <p>I have changed my connection string from "Driver={SQL Server Native Client 11.0}" to "Provider=MSOLEDBSQL" along with UID,PWD,Server,Database parameters.</p>
  
  <p>But I could not able to connect to the Database and getting "[Microsoft][ODBC Driver Manager] Dialog failed"error message when using SQL_DRIVER_COMPLETE.</p>
  
  <pre><code>IM008   Dialog failed   The driver attempted to display its login dialog box and failed.
  
  WindowHandle was a null pointer, and DriverCompletion was not SQL_DRIVER_NO_PROMPT.
  </code></pre>
  
  <p>Similarly, when used SQL_DRIVER_NOPROMPT, it throws an error "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".</p>
  
  <pre><code>IM002   Data source not found and no default driver specified   (DM) The data source name specified in the connection string (InConnectionString) was not found in the system information, and there was no default driver specification.
  (DM) ODBC data source and default driver information could not be found in the system information.
  </code></pre>
  
  <p>The above errors are returned as a result of a call to SQLDriverConnect().</p>
  
  <p>I have downloaded and installed <a href="https://docs.microsoft.com/en-us/sql/connect/oledb/download-oledb-driver-for-sql-server?view=sql-server-ver15" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/sql/connect/oledb/download-oledb-driver-for-sql-server?view=sql-server-ver15</a> and could see the binaries in the system32 folder.</p>
  
  <p>As per MS Docs, registry settings will be done as part of the installation.</p>
  
  <pre><code>All appropriate registry settings for the OLE DB Driver for SQL Server are made as part of the installation process. 
  </code></pre>
  
  <ol>
  <li><p>Should we do any additional registry configuration or other settings in order to use the MSOLEDBSQL driver ?</p></li>
  <li><p>When I use the Driver keyword as mentioned above it works for native clients. But if I used "Provider=SQLNCLI11" it fails. Any thoughts on this ?</p></li>
  </ol>
  
  <p>I suspect the problem is related to loading the driver.</p>
  
  <p>Appreciate it if anyone could help in fixing this issue.</p>
  
  <p>Thanks in Advance.</p>