⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmlogin.frm

📁 本程序用VB+SQL 2000实现,可以实现小区的住户资料,仪表资料,住户投宿,住户报修等数据的查询,修改,删除,统计和以报表形式打印输出.
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin 
   BackColor       =   &H00C0FFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "用户登录"
   ClientHeight    =   4125
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5415
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4125
   ScaleWidth      =   5415
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   -120
      Top             =   3960
      Visible         =   0   'False
      Width           =   1575
      _ExtentX        =   2778
      _ExtentY        =   661
      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=XiaoQu"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "XiaoQu"
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "UserTable"
      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.Frame Frame1 
      BackColor       =   &H00C0FFFF&
      Height          =   1980
      Left            =   720
      TabIndex        =   1
      Top             =   1080
      Width           =   3735
      Begin VB.TextBox txtUser 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   13.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   450
         Left            =   1440
         TabIndex        =   0
         Top             =   360
         Width           =   1830
      End
      Begin VB.TextBox txtPwd 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   13.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   465
         IMEMode         =   3  'DISABLE
         Left            =   1440
         PasswordChar    =   "*"
         TabIndex        =   2
         Top             =   1080
         Width           =   1830
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0FFFF&
         Caption         =   "用户名:"
         Height          =   180
         Left            =   390
         TabIndex        =   6
         Top             =   510
         Width           =   720
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0FFFF&
         Caption         =   "密   码:"
         Height          =   180
         Left            =   390
         TabIndex        =   5
         Top             =   1140
         Width           =   810
      End
   End
   Begin VB.CommandButton cmdLogin 
      Caption         =   "登  录"
      Height          =   495
      Left            =   1080
      TabIndex        =   3
      Top             =   3360
      Width           =   915
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "重  填"
      Height          =   495
      Left            =   3000
      TabIndex        =   4
      Top             =   3360
      Width           =   915
   End
   Begin VB.Label Label3 
      BackColor       =   &H00C0FFFF&
      Caption         =   "小区物业管理系统"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   26.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   615
      Left            =   600
      TabIndex        =   7
      Top             =   360
      Width           =   4455
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs_user As New ADODB.Recordset

Private Sub cmdCancel_Click()
    txtUser.Text = ""
    txtPwd.Text = ""
End Sub

Private Sub cmdLogin_Click()
    '首先检查用户是否输入了用户名和密码
    If txtUser.Text = "" Then
       MsgBox "请输入用户名!", vbOKOnly + vbInformation, "注意"
       txtUser.SetFocus
       Exit Sub
    ElseIf txtPwd.Text = "" Then
       MsgBox "请输入密码!", vbOKOnly + vbInformation, "注意"
       txtPwd.SetFocus
       Exit Sub
    End If
    Dim sqluser As String
    '构造查询该用户名和密码的sql语句
    sqluser = "select * from UserTable where Username = '" & txtUser.Text _
    & "' and Password = '" & txtPwd.Text & "'"
    rs_user.CursorLocation = adUseClient
    '打开数据游标
    rs_user.Open sqluser, conn, adOpenKeyset, adLockPessimistic
    If rs_user.EOF = True Then
       MsgBox "用户名或密码不正确!", vbOKOnly + vbInformation, "注意"
       rs_user.Close
       '清空txtUser和txtPwd文本框
       txtUser.Text = ""
       txtPwd.Text = ""
       Exit Sub
    Else
       '还需使其他菜单可用
       MDIfrmMain.mnAddUser.Enabled = True
       MDIfrmMain.mnBasicData.Enabled = True
       MDIfrmMain.mnWuYe.Enabled = True
       MDIfrmMain.mnDataTg.Enabled = True
       
       MDIfrmMain.Toolbar1.Enabled = True
       
       '提示用户登录成功并关闭游标和登录窗口
       MsgBox "登录成功!", vbOKOnly + vbInformation, "注意"
       rs_user.Close
       Unload Me
    
    End If
    
End Sub

Private Sub Combo1_Change()

End Sub

Private Sub Form_Load()
   Dim X0 As Long
   Dim Y0 As Long
   '让窗体居中
   X0 = Screen.Width
   Y0 = Screen.Height
   X0 = (X0 - Me.Width) / 2
   Y0 = (Y0 - Me.Height) / 2
   Me.Move X0, Y0

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -