简体   繁体   English

无法将 MS Access 前端连接到 SQL 服务器后端

[英]Can't connect MS Access front end to SQL Server back end

I have imported data to SQL Server Express from MS Access and have tried to link to the data from an Access front end file.我已从 MS Access 将数据导入 SQL Server Express 并尝试链接到 Access 前端文件中的数据。

I have tried several different login types, but each gives me the same error:我尝试了几种不同的登录类型,但每种都给了我相同的错误:

Error Locating Server/Instance Specified查找指定的服务器/实例时出错

Please help.请帮忙。

Assuming a local instance of SQL server?假设 SQL 服务器的本地实例?

The default is usually YOURCOMPUTERNAME\SQLEXPRESS.默认值通常是 YOURCOMPUTERNAME\SQLEXPRESS。

But, you can use a "."但是,您可以使用“。” (dot) in place of your computer name. (点)代替您的计算机名称。 So, the server name should be.\SQLEXPRESS所以,服务器名称应该是.\SQLEXPRESS

A few things: When you setup and attempt to connect?一些事情:当您设置并尝试连接时? Always create a FILE dsn.始终创建一个 FILE dsn。 The reasons for this are many, but one really nice reason is that then Access will by default create a DSN-LESS connection.造成这种情况的原因很多,但一个非常好的原因是,Access 将默认创建一个 DSN-LESS 连接。 This approach is preferred since then Access remembers the settings, and no external settings (such as registry or even a file (dsn) is used or required. And if you connect to a SQL server on your network? Well then you can distribute the access application to each workstation, and it will "just work" - all without you having to setup a DSN or do anything with the ODBC manager on each station. So, a great tip and habit. So, use a FILE dsn (and if you follow the default prompts when linking tables, a FILE dsn is the default anyway).这种方法是首选,因为那时 Access 会记住设置,并且不使用或不需要外部设置(例如注册表甚至文件 (dsn)。如果您连接到网络上的 SQL 服务器?那么您可以分发访问权限应用程序到每个工作站,它将“正常工作” - 所有这些都无需您设置 DSN 或使用每个工作站上的 ODBC 管理器做任何事情。所以,一个很好的提示和习惯。所以,使用 FILE dsn(如果你链接表时遵循默认提示,FILE dsn 无论如何都是默认的)。

Next up: Make sure the sql server browser service is running.下一步:确保 sql 服务器浏览器服务正在运行。 In the past this was often not required, but now it is recommended.过去通常不需要这样做,但现在建议这样做。 That service is this:该服务是这样的:

在此处输入图像描述

Once you sure that service is running?一旦确定该服务正在运行?

Make sure that you enabled named Pipes - in fact I would also enable TCP/IP.确保你启用了命名管道——事实上我也会启用 TCP/IP。 That is found here:可以在这里找到:

在此处输入图像描述

Ok, now the next question: Are you using SQL server logons, or Windows authentication?好的,现在下一个问题:您是使用 SQL 服务器登录,还是 Windows 身份验证?

For now since this is your local stand alone machine?现在,因为这是您的本地独立机器? lets go with windows.让 go 与 windows。

As noted, if you have SSMS installed, then see if it can connect.如前所述,如果您安装了 SSMS,请查看它是否可以连接。 This not only is a quick + easy fast test but it will also tend to give you the hints as to what the server name connect is.这不仅是一个快速 + 简单的快速测试,而且它还会为您提供有关服务器名称 connect 的提示。 (this helps you when you attempt to connect with Access - you can see what worked with SSMS - and better is SSMS does usually figure out the correct computer name for you. (这有助于您在尝试连接 Access 时 - 您可以查看 SSMS 的工作原理 - 更好的是 SSMS 通常会为您找出正确的计算机名称。

So, from Access, you now choose from ribbon "External" data, and then import and link group - choose ODBC.因此,从 Access 中,您现在从功能区“外部”数据中选择,然后导入并链接组 - 选择 ODBC。

the wizard to connect will start.连接向导将启动。 choose "link to the data source".选择“链接到数据源”。

At this point, the panels that start to launch are the same one you see if you try to use the ODBC manager from the control panel - but in most cases this road is better, since Access will correctly launch the x32 or x64 bit ODBC manager (it makes this correct decision for you).此时,开始启动的面板与您尝试从控制面板使用 ODBC 管理器时看到的面板相同 - 但在大多数情况下,这条路更好,因为 Access 将正确启动 x32 或 x64 位 ODBC 管理器(它为您做出正确的决定)。

So you be at a DSN name, but just hit new.因此,您使用的是 DSN 名称,但只是打新。 Now you have to choose a ODBC (for sql server) driver.现在您必须选择 ODBC(用于 sql 服务器)驱动程序。

在此处输入图像描述

For now, I would try "SQL server".现在,我会尝试“SQL server”。 You can choose SQL Server Native Client 11 (or later if you see).您可以选择 SQL Server Native Client 11(或更高版本,如果您看到)。 Either one is fine.任何一个都可以。 Just keep in future mind that SQL Server driver choice exists on all computers - so for future distribution to other workstations, this is a good choice.请记住,SQL 服务器驱动程序选择存在于所有计算机上 - 因此对于将来分发到其他工作站,这是一个不错的选择。 The native 11 (or later) driver is NOT installed by default, and you have to install this on other workstations if you want to use that driver if you move or distribute your application to other workstations.默认情况下不安装本机 11(或更高版本)驱动程序,如果您想在将应用程序移动或分发到其他工作站时使用该驱动程序,则必须在其他工作站上安装它。

Next, and now you can enter a name for this connection (myTestcon or whatever).接下来,现在您可以输入此连接的名称(myTestcon 或其他)。 Hit finish.打完。

You should now see/be at this screen:您现在应该看到/处于此屏幕:

在此处输入图像描述

The dropdown for the server name SHOULD appear and work (it make take 30 seconds).服务器名称的下拉菜单应该出现并且可以工作(这需要 30 秒)。 So, it should show you a server name, and a sql instance.因此,它应该显示一个服务器名称和一个 sql 实例。

Next, and now you have to choose the type of logon接下来,现在您必须选择登录类型

Because this is a local stand alone computer?因为这是本地独立计算机? Well, you can choose windows logons, or sql logons.那么,您可以选择 windows 登录,或 sql 登录。 Being a local computer - choose the default - windows auth.作为本地计算机 - 选择默认值 - windows auth。

在此处输入图像描述

Next.下一个。

NOW VERY VERY important - make sure you change/select the correct database here - SO MANY skip or miss this - and that's painful!!现在非常非常重要 - 确保您在这里更改/选择正确的数据库 - 很多人跳过或错过这个 - 这很痛苦!

This one:这个:

在此处输入图像描述

So make sure you select/change the default from "master" to your database you created when you sent the data to sql server.因此,当您将数据发送到 sql 服务器时,请确保将默认值从“主”选择/更改为您创建的数据库。

Next - (you can try the test data source).接下来——(可以试试测试数据源)。 "ok". “好的”。

Now you are back to the VERY same starting panel.现在你回到了完全相同的起始面板。 Your "name" should be defaulted for the file connection.您的“名称”应默认用于文件连接。 This:这个:

在此处输入图像描述

So, now just click ok.所以,现在只需单击确定。

You can then select the tables you want to link to.然后,您可以 select 要链接到的表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MS Access(前端)和使用SQL Server(后端)的第一条记录中的数据丢失 - Missing data in first record in MS Access (front end) and using SQL Server (back end) 到单个远程SQL Server后端的多个MS Access前端连接 - Multiple MS Access Front end Connections to a Single remote SQL Server Back end 如何使用SQL Server后端从MS Access前端导入新数据 - How to Import New Data from MS Access Front End with SQL Server back end 将多用户访问前端连接到SQL Server后端 - Connecting a Multi User Access Front End to SQL Server Back End 在具有MS Access前端的SQL Server中动态更新记录的问题 - Issues dynamically updating records in SQL Server with MS Access front end MS Access + SQL Server 前端连接问题(#NAME) - MS Access + SQL Server front end concatenation problem (#NAME) MS Access 前端到 SQL 服务器间歇性 ODBC 连接问题 - MS Access front end to SQL Server intermittant ODBC connection issues 将 MS Access 后端迁移到 SQL 服务器 - Migrate MS Access back-end to SQL Server 加快 Access 前端与 SQL Server 后端中整数日期的比较 - Speed up comparison of Integer dates in Access front end to SQL Server back end 访问连接到 Azure SQL Server 后端的本地前端非常慢 - Access local front-end connected to Azure SQL Server back-end very slow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM