[英]Make a Login System using VBA with Access Database
userform for login existing account用于登录现有帐户的用户表单
as the image links above, i want to ask about how to connect excel and access database.如上面的图片链接,我想问一下如何连接excel和访问数据库。 I will make some points about my problems:我将就我的问题提出几点意见:
- there are 2 buttons, "Login" and "New Account".有 2 个按钮,“登录”和“新帐户”。 For Login, it should be validating both username and password from "login" table, then the fullname of user will be copied.对于登录,它应该验证“登录”表中的用户名和密码,然后将复制用户的全名。
- Login for existed user will have a combobox, where they can find their username but not the password.现有用户的登录将有一个组合框,他们可以在其中找到他们的用户名,但不能找到密码。
- for the "new account" button, it will ask new username, new fullname, and new password(cant post more than 2 photos rn).对于“新帐户”按钮,它会询问新用户名、新全名和新密码(不能发布超过 2 张照片)。 I still can figured it out how to do that我仍然可以想出如何做到这一点
Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=E:\Digital QC Project\Database.accdb;"
Set rs = New ADODB.Recordset
rs.Open "login", cn, adOpenKeyset, adLockOptimistic, adCmdTable
With rs
.AddNew
.Fields("username") = Range("A4").Value
.Fields("password") = Range("B4").Value
.Fields("fullname") = Range("C4").Value
.Update
End With
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
is that possible to work on first and second point?这可能适用于第一点和第二点吗? thanks stackoverflow!感谢stackoverflow!
If you are tying Excel to Access, then bypassing that will be trivial.如果您将 Excel 绑定到 Access,那么绕过它就很简单了。 So I assume you are not trying to enforce security using Access from excel with this method.因此,我假设您不会尝试通过此方法使用 excel 中的 Access 来强制执行安全性。
If you are then you need to go back to the drawing board.如果你是,那么你需要回到绘图板。 You cannot store the credentials in Access and then expect to use them to enforce security later.您不能将凭据存储在 Access 中,然后期望稍后使用它们来强制执行安全性。 Instead, you need to spend some time re-architecting your solution around:相反,您需要花一些时间重新构建您的解决方案:
In addition I would STRONGLY recommend hashing the password with a salt so that it can be tested but not read.此外,我强烈建议使用盐对密码进行哈希处理,以便可以对其进行测试但无法读取。 As it is anyone with Excel can probably read the passwords of the users.因为任何使用 Excel 的人都可以读取用户的密码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.