DSN Less Connection (MS Access to SQL2016)

流过昼夜 提交于 2019-12-12 20:23:26

问题


I have this solution that works when I want to convert linked tables to a DSNLess Connection:

http://www.accessmvp.com/djsteele/DSNLessLinks.html

But it's always been an Access DB (2010 or 2013) to SQL2012. I now have a SQL2016 instance that I'm trying to make a DSNLess Connection to. So here is what I've tried:

Running the code as given in the article.. This gives me an SSL Security Error.

Changing the Connection to use:

strConnectionString = "Provider=SQLNCLI11;" & _
   "Server=" & ServerName & ";" & _
   "Database=" & DatabaseName & ";" & _
   "Trusted_Connection=Yes;"

When I do this, it gives me "Could not find installable ISAM". What do I need to change to get this to work with SQL2016?


回答1:


Well, right after posting this I found my solution. In this article I found you can just list the driver:

https://docs.microsoft.com/en-us/sql/integration-services/import-export-data/connect-to-an-odbc-data-source-sql-server-import-and-export-wizard

So, what I did was make my connection be this:

strConnectionString = "ODBC;Driver={SQL Server Native Client 11.0};" & _
   "Database=" & DatabaseName & ";" & _
   "Server=" & ServerName & ";" & _
   "Trusted_Connection=Yes;"

And it worked perfectly.



来源:https://stackoverflow.com/questions/44729231/dsn-less-connection-ms-access-to-sql2016

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!