如何以编程方式创建 DSN?

编程入门 行业动态 更新时间:2024-10-08 02:27:10
本文介绍了如何以编程方式创建 DSN?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个使用链接的 sql server 表作为数据源的访问表单.我需要尽快将这个文件分发给其他用户,我需要一种方法来以编程方式将 DSN 安装到他们的机器上.这是手动设置链接的过程:

I have an Access Form that uses a linked sql server table as a datasource. I will need to distribute this file to other users soon and I need a way to programmaticly install the DSN to their machines. This is the process of manually setting up the link:

外部数据 > 更多 > ODBC 数据库 > 数据源链接 > 机器数据源选项卡 >按新建 > 用户数据源 > sql server > name=up to you;server= serverName > SQL server 如何验证登录ID的真实性?使用网络登录ID进行Windows NT身份验证 >附加数据库文件名(数据库名称)>选择表并按确定

External Data > More > ODBC Database > Link to data source > Machine data source tab > press new > user data source > sql server > name=up to you; server= serverName > How should SQL server verify the autheticity of the login ID? With windows NT authentication using the network login ID > Attach database File Name (database name) > choose the table and press ok

这就是我访问我的表时所做的,但我希望用户可以按下按钮并访问该表,同时使用 Windows NT 身份验证进行身份验证.

That is what I did to access my table but I would like it so that the user can press a button and get access to the table and at the same time be authenticated by using windows NT authentication.

我很难找到一种在 access vba 代码中编写此代码的方法,有人可以指导我朝正确的方向发展吗?

I am having trouble finding a way to write this in access vba code can someone direct me in the right direction?

推荐答案

作为一般规则,您会发现使用无 DSN 的连接会取得更大的成功.这将消除许多问题和问题.此处概述了如何使用无 DSN 连接:

As a general rule you find MUCH better success by using a DSN less connection. This will eliminate many issues and problems. How to use a DSN less connection is outlined here:

www.accessmvp/DJSteele/DSNLessLinks.html

而且您也不想在连接字符串中存储用户名 + 密码,而只想登录"一次.这再次节省了大量麻烦,也意味着您的连接字符串和/或 DSN 不必在实际链接中保存和公开用户名和密码.

And also you do NOT want to store the user name + password in the connection string, but only "log on" one time. Again this saves huge hassles and also means your connection strings and/or DSN does not have to save and expose the user name and password in the actual links.

这种方法意味着您可以有不同的登录,而不必重新链接或更改现有的表链接.

And this approach means you can have different logons and NOT have to re-link or change existing table links.

以下显示了如何使用缓存登录,从而允许用户进行不同的登录,而无需重新链接您的表.

The follow shows how to use a cached logon and this thus allows one to have different logons without having to re-link your tables.

blogs.office/en-us/2011/04/08/power-tip-improve-the-security-of-database-connections/

我强烈建议您在使用链接表到 SQL Server 时采用上述两种方法.

I highly recommend you adopt both of the above approaches when using linked tables to SQL server.

更多推荐

如何以编程方式创建 DSN?

本文发布于:2023-11-28 11:18:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642187.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方式   DSN

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!