www.pudn.com > 2005.rar > frmLogin.frm, change:2007-06-19,size:6072b


VERSION 5.00 
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX" 
Begin VB.Form frmLogin  
   BackColor       =   &H00FFC0FF& 
   BorderStyle     =   3  'Fixed Dialog 
   Caption         =   "登录" 
   ClientHeight    =   2745 
   ClientLeft      =   2835 
   ClientTop       =   3480 
   ClientWidth     =   5775 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   1621.837 
   ScaleMode       =   0  'User 
   ScaleWidth      =   5422.414 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   2  '屏幕中心 
   Begin MSAdodcLib.Adodc Adodc1  
      Height          =   735 
      Left            =   2160 
      Top             =   360 
      Visible         =   0   'False 
      Width           =   1455 
      _ExtentX        =   2566 
      _ExtentY        =   1296 
      ConnectMode     =   0 
      CursorLocation  =   3 
      IsolationLevel  =   -1 
      ConnectionTimeout=   15 
      CommandTimeout  =   30 
      CursorType      =   3 
      LockType        =   3 
      CommandType     =   2 
      CursorOptions   =   0 
      CacheSize       =   50 
      MaxRecords      =   0 
      BOFAction       =   0 
      EOFAction       =   0 
      ConnectStringType=   3 
      Appearance      =   1 
      BackColor       =   -2147483643 
      ForeColor       =   -2147483640 
      Orientation     =   0 
      Enabled         =   -1 
      Connect         =   "DSN=cheliang" 
      OLEDBString     =   "" 
      OLEDBFile       =   "" 
      DataSourceName  =   "cheliang" 
      OtherAttributes =   "" 
      UserName        =   "" 
      Password        =   "" 
      RecordSource    =   "用户管理" 
      Caption         =   "Adodc1" 
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
         Name            =   "宋体" 
         Size            =   9 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      _Version        =   393216 
   End 
   Begin VB.TextBox txtUserName  
      DataSource      =   "Adodc1" 
      Height          =   345 
      Left            =   1200 
      TabIndex        =   1 
      Top             =   1200 
      Width           =   2325 
   End 
   Begin VB.CommandButton cmdOK  
      BackColor       =   &H00FFFFFF& 
      Caption         =   "确定" 
      Default         =   -1  'True 
      Height          =   390 
      Left            =   480 
      TabIndex        =   4 
      Top             =   2280 
      Width           =   1140 
   End 
   Begin VB.CommandButton cmdCancel  
      Cancel          =   -1  'True 
      Caption         =   "取消" 
      Height          =   390 
      Left            =   2160 
      TabIndex        =   5 
      Top             =   2280 
      Width           =   1140 
   End 
   Begin VB.TextBox txtPassword  
      Height          =   345 
      IMEMode         =   3  'DISABLE 
      Left            =   1200 
      PasswordChar    =   "*" 
      TabIndex        =   3 
      Top             =   1800 
      Width           =   2325 
   End 
   Begin VB.Image Image1  
      Height          =   2715 
      Left            =   3720 
      Picture         =   "frmLogin.frx":0000 
      Top             =   0 
      Width           =   2055 
   End 
   Begin VB.Label Label1  
      BackColor       =   &H0000C000& 
      Caption         =   "欢迎登陆使用" 
      BeginProperty Font  
         Name            =   "Arial Black" 
         Size            =   21.75 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   615 
      Left            =   120 
      TabIndex        =   6 
      Top             =   240 
      Width           =   3375 
   End 
   Begin VB.Label lblLabels  
      BackColor       =   &H00FFC0FF& 
      Caption         =   "用户名称(&U):" 
      Height          =   270 
      Index           =   0 
      Left            =   0 
      TabIndex        =   0 
      Top             =   1200 
      Width           =   1080 
   End 
   Begin VB.Label lblLabels  
      BackColor       =   &H00FFC0FF& 
      Caption         =   "密码(&P):" 
      Height          =   270 
      Index           =   1 
      Left            =   0 
      TabIndex        =   2 
      Top             =   1800 
      Width           =   1080 
   End 
End 
Attribute VB_Name = "frmLogin" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
Dim i As Integer 
Public str1 As String 
Public str2 As String 
Public rs1 As New ADODB.Recordset 
Public com As New ADODB.Command 
Public LoginSucceeded As Boolean 
 
Private Sub cmdCancel_Click() 
    '设置全局变量为 false 
    '不提示失败的登录 
    LoginSucceeded = False 
    Unload Me 
End Sub 
 
Private Sub cmdOK_Click() 
    '检查正确的密码 
   Call open_db 
   If txtUserName.Text = Empty Then 
      MsgBox "用户名不能为空", vbCritical, vbOKOnly 
      Call close_db 
      Exit Sub 
   End If 
   Set rs1 = New ADODB.Recordset 
   str1 = "Select * From 用户管理 where 用户名='" & txtUserName.Text & "'and 用户密码='" & txtPassword.Text & "'" 
   rs1.Open str1, adocon, , adLockPessimistic 
   If (rs1.EOF = True And rs1.BOF = True) Then 
         MsgBox "您输入的信息有误,请重新输入!", , "系统提示" 
        txtUserName.Text = "" 
        txtPassword.Text = "" 
        Call close_db 
        i = i + 1 
        If i = 3 Then 
            MsgBox "对不起,您已无权使用本系统!", , "系统提示" 
            Unload Me 
        End If 
    Else 
         frmMain.Show 
         rs1.Close 
         Call close_db 
         Unload Me 
    End If 
End Sub 
 
Private Sub Form_Load() 
    txtUserName.Text = Empty 
End Sub