跟进:通常,将Access与SQL Server一起使用时,请使用链接表.然后,您可以像往常一样继续使用Access.因此,您可以简单地将表单与该链接表绑定到SQL Server,从而无需编写任何代码即可运行表单和报表.因此,tableDefs(链接的)和querydefs都具有连接属性.看来querydefs没有我上面概述的保存密码"属性.这可能意味着,如果您指定了DSN,则不会保存任何密码等,因为它在DSN中是期望的.因此,尝试删除DSN部分-这样,您正在创建的DSN较少的连接.省略DSN部分,应该可以保存/指定字符串中的uid/密码.如果使用文件或计算机DSN,我还将检查可能的不同行为(一个使用文件,另一个使用注册表).While testing an Access file after restructuring I frequently flipped between credentials for the UID and PWD of the ODBC connection string, but something I did recently has caused Access to no longer show the full connection string.I have 4 production pass-through queries and 1 test pass-through query. The test pass-through query shows the full ODBC connection string, but the 4 production pass-through queries show only ODBC;DSN=schema_name;. I tried restating the ODBC connection:a) I click the three dotsb) The "Select Data Source" box opensc) I select the data sourced) I choose "Yes" to save the password in the connection string.Yet after this it still only displays the abbreviated connection string. What do I need to do to have MS Access display the full connection string?Should the connection string UID and PWD always match that which is saved in the ODBC data source configuration box?Using Access 2010Saved in .mdb (Access 2000) formatUser DSN: MySQL ODBC 5.3 Unicode DriverSystem DSN: MySQL ODBC 5.3 ANSI Driver 解决方案 The saving of the UID/password is determined how you FIRST created the table link. If you checked the "save password" in the connection string, then any re-linking and including the uid/password WILL BE saved and will be CLEARLY visible in the string.If you did NOT check the box "save password" then re-linking and EVEN WHEN YOU include the uid/password, it will NOT be saved in the connection string. And thus if you have not logged into that server, then opening such a linked table will cause a logon or an odbc connection error. However, if you logged into that table, then access caches the uid/password for that session.So "how" you created the link will determine if the uid/password is saved. The tabledef attribute that controls this setting is thus:MyTableDef.Attributes = DB_ATTACHSAVEPWDAs a general rule it is MUCH better to NOT include the uid/password in those links. Best to execute a logon at the start of the application. This also means that you can use different uid/passwords and NOT have to re-link the tables. I don’t think that querydefs have this setting, but they will ALSO work without the uid/password if the user has logged on to the database.So, to answer your question: An option (attribute) setting exists that will cause the uid/password to be saved, or not saved. This option OVERRIDES the cause when INCLUDE the uid/password in the connection string – it will be removed and NOT saved if the table def does NOT have the above attribute setting that allows saving of the uid/password in the connection string.Here is a great article that explains how to have all your tables connect and work without having to include the uid/password in the connection. The "trick" involves simply executing a logon at the start of your application.Power Tip: Improve the security of database connectionshttp://blogs.office.com/b/microsoft-access/archive/2011/04/08/power-tip-improve-the-security-of-database-connections.aspxfollow up:As a general rule when you using Access with SQL server, you use linked tables. You then can continue to use Access as you always did. You can thus simply bind a form to that linked table to SQL server and thus you have forms and reports that work without the need for writing ANY code. So both tableDefs (linked ones) and querydefs have a connection property.It looks like querydefs don’t have the "save password" attribute I outline above. This likely means that if you specify a DSN, then no password etc. is saved since it is expected in the DSN. So, try removing the DSN part – by doing this, you are creating a DSN less connection. Leaving out the DSN part should allow you to save/specify the uid/password in the string. I would also check for possible different behaviors if using a file or machine DSN (one uses a file, the other uses the registry). 这篇关于MS Access在属性表中不再显示完整的ODBC连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-02 00:23