Private Sub cmdOK_Click()
'************************************************************************
' Purpose : Authenticates the user and load the security informations from the database.
' Comment : Visual Guard authenticates the user.
' History : NOVALYS - 2001/10/20 - Creation
'************************************************************************
Dim intRet As Integer
On Error GoTo ErrorHandler
OK = True
Me.Hide
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDASQL;dsn=Visual Guard Sample DB;uid=dba;pwd=sql;"
If MyVisualGuard.SetConnection(db) < 0 Then
Exit Sub
End If
'=======================================================
' Authenticates the user and loads security informations
'=======================================================
intRet = MyVisualGuard.VerifyUser(txtUserName.Text, txtPassword.Text)
If intRet < 0 Then
db.Disconnect
Me.OK = False
Me.Show vbModal
Exit Sub
End If
'=======================================================
Exit Sub
ErrorHandler:
Select Case Err.Number
Case Else
MsgBox Err.Description, , "Visual Guard : Login"
Me.OK = False
End Select
End Sub
|