三层结构的crm,在frmlogin窗体中在验证密码时,用g_conn进行数据库连接,执行时报错"未定义变量",如明明在Activex dll中用public定义了g_conn as connection,为什么?
报错部位:
rivate Sub cmdOK_Click()
Dim strSQL As String
Dim strPwd As String
Dim rec As Recordset
Set g_Conn = New Connection
'判断原密码是否正确
strSQL = "SELECT * FROM managerclient WHERE [userName]='" & txtUserName.Text & "'"
Set rec = g_Con.Execute(strSQL)
If rec.EOF Or Err.Number <> 0 Then
MsgBox "此用户不存在!", 0 + 16, "笙馆CRM系统"
Exit Sub
End If
strPwd = rec("password").Value
Print strPwd
Print txtPassword.Text
If Trim(strPwd) <> Trim(txtPassword.Text) Then
MsgBox "密码正确!", 0 + 16, "笙馆CRM系统"
Exit Sub
End If
Me.Hide