帮我看看这段代码问题出在哪,一个登录窗体
照书上打的,数据库也连接成功,是Access数据库
Private Sub cmdOK_Click() Adodc1.RecordSource = "select * from User where UserName='" + txtUserName.Text + "'" Adodc1.Refresh If Adodc1.Recordset.RecordCount > 0 Then If txtPassword = Adodc1.Recordset.Fields("Password") Then '将代码放在这里传递 '成功到 calling 函数 '设置全局变量时最容易的 LoginSucceeded = True MsgBox "登录成功" Me.Hide Else MsgBox "无效的密码,请重试!", , "登录" txtPassword.SetFocus SendKeys "{Home}+{End}" End If Else MsgBox "无此用户" End If End Sub