如何将alogin代码连接到ms访问数据库 [英] how to connect alogin code to ms access database
本文介绍了如何将alogin代码连接到ms访问数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
希望一切都很好,我已经创建了四张桌子,每张桌子都有一个表格和水晶。现在我已经创建了一个用户表,其密码和用户名也是alogin形式。我想打开数据库,首先出现alogin表单,以便用户输入他/她的密码来访问数据库。请帮我解决这个问题,我已经失败了。
问候
Asaku Richards
hope all is fine,ihave created four tables,each with a form and aquerry. Now ihave created also a user table with password and username created also alogin form. Iwant to open the database such that alogin form appears first so that the user inputs his/her password to access the database. please help me with this problem,ihave failed somewhere.
regards
Asaku Richards
推荐答案
你好,
你想要一个简单的登录表单来验证Ms access db中的有效用户。
这里是vb.net的示例代码。 />
Hi,
Do you want a simple login form validating the valid user from Ms access db.
here is sample code with vb.net.
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\testdb1.mdb;Jet OLEDB:Database Password=1234;")
Dim cmd As OleDbCommand = New OleDbCommand("Select * from testtable where username= '" & TextBox1.Text & "' ", cn)
cn.Open()
rdr = cmd.ExecuteReader
If rdr.HasRows Then
'' do your code here
Else
MsgBox("Incorrect Username/Password")
TextBox1.Clear()
TextBox1.Clear()
End If
这篇关于如何将alogin代码连接到ms访问数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文