在将Microsoft Access连接到Delphi 7时尝试执行SQL查询时的用户名和密码提示

时间:2021-12-12 21:19:43

As part of my university coursework, I was asked to design and create an HCI for a shop. Part of it is to connect Delphi 7 to MS Access and run SQL queries. I have the database connected to Delphi, but when I run the program and enter the query it prompts me to enter a username and password to access the database. Does anyone have any ideas on what's going on? I am stumped for ideas!

作为我大学课程的一部分,我被要求为商店设计和创建一个HCI。部分原因是将Delphi 7连接到MS Access并运行SQL查询。我将数据库连接到Delphi,但是当我运行程序并输入查询时,它会提示我输入用户名和密码来访问数据库。有没有人对正在发生的事情有任何想法?我很难过想法!

Any help is greatly appreciated!

任何帮助是极大的赞赏!

Andy

3 个解决方案

#1


Simple solution, the LoginPrompt to FALSE on your TAdoDatabase component. Make sure that your query object then is linked to the database component.

简单的解决方案,您的TAdoDatabase组件上的LoginPrompt为FALSE。确保您的查询对象随后链接到数据库组件。

#2


One of the things that puzzles many people is the way Jet user-level security works. When you are running Access, you are logging on whether you know it or not. If you see no username/password prompt when you open an MDB, you are logging on as the ADMIN users with no password.

令许多人困惑的事情之一是Jet用户级安全性的工作方式。当您运行Access时,您正在登录是否知道它。如果在打开MDB时未看到用户名/密码提示,则表示您以没有密码的ADMIN用户身份登录。

Thus, to open any Jet MDB, you need to provide a valid username/password pair. If you have not set a password on the admin account, you still need to provide the admin username with no password.

因此,要打开任何Jet MDB,您需要提供有效的用户名/密码对。如果您尚未在管理员帐户上设置密码,则仍需要提供没有密码的管理员用户名。

#3


You need to set the LoginPrompt property to True, but also implement the OnLogin event. In that event, set username (and if available password) of the LoginParams parameter of the event.

您需要将LoginPrompt属性设置为True,还要实现OnLogin事件。在该事件中,设置事件的LoginParams参数的用户名(以及可用密码)。

#1


Simple solution, the LoginPrompt to FALSE on your TAdoDatabase component. Make sure that your query object then is linked to the database component.

简单的解决方案,您的TAdoDatabase组件上的LoginPrompt为FALSE。确保您的查询对象随后链接到数据库组件。

#2


One of the things that puzzles many people is the way Jet user-level security works. When you are running Access, you are logging on whether you know it or not. If you see no username/password prompt when you open an MDB, you are logging on as the ADMIN users with no password.

令许多人困惑的事情之一是Jet用户级安全性的工作方式。当您运行Access时,您正在登录是否知道它。如果在打开MDB时未看到用户名/密码提示,则表示您以没有密码的ADMIN用户身份登录。

Thus, to open any Jet MDB, you need to provide a valid username/password pair. If you have not set a password on the admin account, you still need to provide the admin username with no password.

因此,要打开任何Jet MDB,您需要提供有效的用户名/密码对。如果您尚未在管理员帐户上设置密码,则仍需要提供没有密码的管理员用户名。

#3


You need to set the LoginPrompt property to True, but also implement the OnLogin event. In that event, set username (and if available password) of the LoginParams parameter of the event.

您需要将LoginPrompt属性设置为True,还要实现OnLogin事件。在该事件中,设置事件的LoginParams参数的用户名(以及可用密码)。