www.pudn.com > VBproject VCD.rar > UserLogin.cls, change:2003-05-22,size:1179b


VERSION 1.0 CLASS 
BEGIN 
  MultiUse = -1  'True 
  Persistable = 0  'NotPersistable 
  DataBindingBehavior = 0  'vbNone 
  DataSourceBehavior  = 0  'vbNone 
  MTSTransactionMode  = 0  'NotAnMTSObject 
END 
Attribute VB_Name = "UserLogin" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = True 
Attribute VB_PredeclaredId = False 
Attribute VB_Exposed = False 
Dim con As Connection 
Dim rst As Recordset 
 
Public Function UserLogin(ManageID As String, password As String) As Boolean 
 
Set con = New Connection 
 
With con 
    .Provider = "SQLOLEDB" 
    .ConnectionString = "user id=sa;password=;data source =QIANJI; initial catalog=movie" 
    .Open 
End With 
 
Set rst = New Recordset 
 
rst.Open "select cPassword from manager where cManageID='" & Trim(Text1) & "'", con, adOpenDynamic, adLockBatchOptimistic 
 
 
Dim bl As Boolean 
 
If rst.EOF = True Then 
   MsgBox "该用户不存在!", vbExclamation, "错误提示" 
   Exit Function 
Else 
   If rst(0) = password Then 
      MsgBox "验证成功!", vbInformation, "信息提示" 
      bl = True 
   Else 
      MsgBox "密码错误!", vbExclamation, "错误提示" 
      Exit Function 
   End If 
End If 
 
End Function