简体   繁体   English

将 MS Access 连接到网络上的 SQL 服务器

[英]Connecting MS Access to SQL Server on a network

I have SQL Server Express on a windows server.我在 windows 服务器上有 SQL 服务器 Express。 I have 10 people with MS Access 2016 on the local PCs.我有 10 个人在本地 PC 上使用 MS Access 2016。 assuming that the db is very small and simple.假设数据库非常小且简单。 What is the simplest way to connect to SQL Server?连接到 SQL 服务器的最简单方法是什么? Will simple ODBC work?简单的 ODBC 会起作用吗? Do I need to enable remote access?我需要启用远程访问吗? TCP/IP? TCP/IP? Pipes?管道?

ODBC is the simple and proven method. ODBC 是简单且经过验证的方法。

Sidenote :旁注

Consider the method using a script and a shortcut to distribute the frontend to the users as described in my article:考虑使用脚本和快捷方式将前端分发给用户的方法,如我的文章中所述:

Deploy and update a Microsoft Access application with one click 一键部署和更新 Microsoft Access 应用程序

(If you don't have an account, browse for the link: Read the full article.) (如果您没有帐户,请浏览链接:阅读全文。)

Yes, the basic concept here is to use linked tables.是的,这里的基本概念是使用链接表。 It not clear if before using SQL server, you were using Access in a mutlti-user mode.不清楚在使用 SQL 服务器之前,您是否在多用户模式下使用 Access。

The general idea here is you have a split database.这里的一般想法是你有一个拆分数据库。 So you have the application part or so called front end.所以你有应用程序部分或所谓的前端。 This concept is really no different than say running word, or excel.这个概念实际上与说运行词或 excel 没有什么不同。 These applications are installed on each workstation.这些应用程序安装在每个工作站上。 But THEN the application can use some file.但是然后应用程序可以使用一些文件。

So, in a typical multi-user Access applications, you have your application part installed on each machine (the front end).因此,在典型的多用户 Access 应用程序中,您的应用程序部分安装在每台机器(前端)上。

Then you will typical place the back end file in some folder on the server.然后,您通常会将后端文件放在服务器上的某个文件夹中。 And then your front end will have linked tables to the back end.然后你的前端将有链接到后端的表。

If you adopt sql server for the back end?如果后端采用 sql 服务器? Then the setup is really the same as above.然后设置真的和上面一样。 You have the front end application part that you install on each machine, and you have linked tables like before.您拥有安装在每台机器上的前端应用程序部分,并且您拥有像以前一样的链接表。 The only difference is now your linked tables are pointing to SQL server.唯一的区别是现在您的链接表指向 SQL 服务器。

So, yes you do have to enable TCP/IP for SQL server.所以,是的,您必须为 SQL 服务器启用 TCP/IP。 You also have to decide if you going to use windows authentication for the users (that is windows logon).您还必须决定是否要为用户使用 windows 身份验证(即 windows 登录)。 You can really only from a practical use case use windows authentication if you have a domain controller.如果您有域 controller,您实际上只能从实际用例中使用 windows 身份验证。 (A computer that manages permissions to all your computers). (管理所有计算机权限的计算机)。 If you are not sure or don't have a domain?如果您不确定或没有域? Well then you will need to create and use SQL server logons.那么您将需要创建和使用 SQL 服务器登录。 Most often, you can create one logon/user for SQL server and have all of the access FE use this one logon.大多数情况下,您可以为 SQL 服务器创建一个登录/用户,并让所有访问 FE 使用这个登录。 (so once again, you link the FE's using the Access linked table manager, and you use + save this logon during the linking process). (因此,再次使用 Access 链接表管理器链接 FE,并在链接过程中使用 + 保存此登录)。

As as a standard approach, how your application will work is really the same when using SQL server or not.作为标准方法,无论是否使用 SQL 服务器,您的应用程序的工作方式都是相同的。 In these use case examples, you use linked tables in the front end.在这些用例示例中,您在前端使用链接表。 In fact if you had a access back end, and now use SQL server for the back end, then all your forms and even the VBA code should work as before.事实上,如果你有一个访问后端,现在使用 SQL 服务器作为后端,那么你所有的 forms 甚至 VBA 代码都应该像以前一样工作。 There are often some “minor” changes to code that uses recordets, but the forms etc. should work as before.使用记录的代码通常会有一些“微小”的变化,但 forms 等应该像以前一样工作。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM