★★★急求!!!!!★★★vb 6.0和access 2003连接时出现未发现数据源名称并且未指定默认驱动程序是怎么回事?
整个窗体界面的代码如下,想知道到底是怎么回事?急求!DimpwLimitNAsInteger'登录次数限制变量DimMD5passwordAsString'密码加密变量P...
整个窗体界面的代码如下,想知道到底是怎么回事?急求!
Dim pwLimitN As Integer '登录次数限制变量
Dim MD5password As String '密码加密变量
Private Sub Data1_Validate(Action As Integer, Save As Integer)
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\SupermarketDB.mdb " & ";Mode=ReadWrite;Persist Security Info=False"
Adodc1.RecordSource = "select * from UserTB order by 姓名"
Adodc1.Refresh
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\SupermarketDB.mdb " & ";Mode=ReadWrite;Persist Security Info=False"
Adodc2.RecordSource = "select * from UserTB order by 姓名"
Adodc2.Refresh
End Sub
Private Sub labCancel_Click()
If MsgBox("确实要退出吗?", vbQuestion + vbYesNo + vbDefaultButton2, "用户登录") = vbYes Then
Unload Me
End If
End Sub
Private Sub labOK_Click()
MD5password = MD5(Trim(txtPassword.Text))
Adodc1.RecordSource = "SELECT * FROM UserTB WHERE( 姓名='" & dcUserName.Text & "')"
Adodc1.Refresh
If pwLimitN = 2 Then
MsgBox "您输入用户名和密码错误已经超过3次,您好无权登录此系统!请与管理员联系!", vbExclamation + vbOKOnly + vbDefaultButton1, "用户登录"
Unload Me
ElseIf Adodc1.Recordset.RecordCount = 0 Then
MsgBox "用户名不存在,请重新输入!", vbExclamation, "用户登录"
pwLimitN = pwLimitN + 1
dcUserName.SetFocus
ElseIf MD5password <> Trim(Adodc1.Recordset.Fields(1)) Then
MsgBox "密码错误,请重新输入!", vbExclamation, "用户登录"
pwLimitN = pwLimitN + 1
txtPassword.Text = ""
txtPassword.SetFocus
ElseIf MD5password = Trim(Adodc1.Recordset.Fields(1)) Then
CurrentUser = Trim(Adodc1.Recordset.Fields(0))
CurrentUserAuthority = Trim(Adodc1.Recordset.Fields(3))
Load mdiMain
mdiMain.Show
Unload Me
End If
End Sub
Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then labOK_Click
End Sub 展开
Dim pwLimitN As Integer '登录次数限制变量
Dim MD5password As String '密码加密变量
Private Sub Data1_Validate(Action As Integer, Save As Integer)
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\SupermarketDB.mdb " & ";Mode=ReadWrite;Persist Security Info=False"
Adodc1.RecordSource = "select * from UserTB order by 姓名"
Adodc1.Refresh
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\SupermarketDB.mdb " & ";Mode=ReadWrite;Persist Security Info=False"
Adodc2.RecordSource = "select * from UserTB order by 姓名"
Adodc2.Refresh
End Sub
Private Sub labCancel_Click()
If MsgBox("确实要退出吗?", vbQuestion + vbYesNo + vbDefaultButton2, "用户登录") = vbYes Then
Unload Me
End If
End Sub
Private Sub labOK_Click()
MD5password = MD5(Trim(txtPassword.Text))
Adodc1.RecordSource = "SELECT * FROM UserTB WHERE( 姓名='" & dcUserName.Text & "')"
Adodc1.Refresh
If pwLimitN = 2 Then
MsgBox "您输入用户名和密码错误已经超过3次,您好无权登录此系统!请与管理员联系!", vbExclamation + vbOKOnly + vbDefaultButton1, "用户登录"
Unload Me
ElseIf Adodc1.Recordset.RecordCount = 0 Then
MsgBox "用户名不存在,请重新输入!", vbExclamation, "用户登录"
pwLimitN = pwLimitN + 1
dcUserName.SetFocus
ElseIf MD5password <> Trim(Adodc1.Recordset.Fields(1)) Then
MsgBox "密码错误,请重新输入!", vbExclamation, "用户登录"
pwLimitN = pwLimitN + 1
txtPassword.Text = ""
txtPassword.SetFocus
ElseIf MD5password = Trim(Adodc1.Recordset.Fields(1)) Then
CurrentUser = Trim(Adodc1.Recordset.Fields(0))
CurrentUserAuthority = Trim(Adodc1.Recordset.Fields(3))
Load mdiMain
mdiMain.Show
Unload Me
End If
End Sub
Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then labOK_Click
End Sub 展开
2个回答
展开全部
例:数据库名:user;表名:account;字段u_id,u_name,u_pass;界面:很长时间没用vb了基本上就是这样。数据库和记录集的关闭可以放到unload事件
追问
你说的我不太明白啊,
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
没有打开驱动!
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.open"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\SupermarketDB.mdb " & ";Mode=ReadWrite;Persist Security Info=False"
Adodc1.ConnectionString =coon
两个都这样改一下试试
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.open"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\SupermarketDB.mdb " & ";Mode=ReadWrite;Persist Security Info=False"
Adodc1.ConnectionString =coon
两个都这样改一下试试
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询