是我的个人设计站长快让我通过啊

源代码在线查看: frmlogin.frm

软件大小: 1528 K
上传用户: koalalee
关键词:
下载地址: 免注册下载 普通下载 VIP

相关代码

				VERSION 5.00
				Begin VB.Form frmLogin 
				   BorderStyle     =   3  'Fixed Dialog
				   Caption         =   "登录"
				   ClientHeight    =   2850
				   ClientLeft      =   30
				   ClientTop       =   330
				   ClientWidth     =   4350
				   LinkTopic       =   "Form1"
				   MaxButton       =   0   'False
				   MinButton       =   0   'False
				   ScaleHeight     =   2850
				   ScaleWidth      =   4350
				   ShowInTaskbar   =   0   'False
				   StartUpPosition =   2  '屏幕中心
				   Tag             =   "Login"
				   Begin VB.CommandButton cmdCancel 
				      Cancel          =   -1  'True
				      Caption         =   "Cancel"
				      Height          =   360
				      Left            =   2100
				      TabIndex        =   5
				      Tag             =   "Cancel"
				      Top             =   2304
				      Width           =   1140
				   End
				   Begin VB.CommandButton cmdOK 
				      Caption         =   "OK"
				      Default         =   -1  'True
				      Height          =   360
				      Left            =   492
				      TabIndex        =   4
				      Tag             =   "OK"
				      Top             =   2304
				      Width           =   1140
				   End
				   Begin VB.TextBox txtPassword 
				      Height          =   288
				      IMEMode         =   3  'DISABLE
				      Left            =   1548
				      PasswordChar    =   "*"
				      TabIndex        =   1
				      Top             =   1812
				      Width           =   2064
				   End
				   Begin VB.TextBox txtUserName 
				      Height          =   288
				      Left            =   1548
				      TabIndex        =   3
				      Top             =   1416
				      Width           =   2064
				   End
				   Begin VB.Label Label1 
				      Alignment       =   1  'Right Justify
				      AutoSize        =   -1  'True
				      Caption         =   "              餐饮行业管理系统"
				      BeginProperty Font 
				         Name            =   "华文彩云"
				         Size            =   24
				         Charset         =   134
				         Weight          =   700
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000001&
				      Height          =   495
				      Left            =   -1635
				      TabIndex        =   6
				      Top             =   120
				      Width           =   5850
				   End
				   Begin VB.Label lblLabels 
				      Caption         =   "密  码:"
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   12
				         Charset         =   0
				         Weight          =   700
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      Height          =   252
				      Index           =   1
				      Left            =   348
				      TabIndex        =   0
				      Tag             =   "&Password:"
				      Top             =   1824
				      Width           =   1080
				   End
				   Begin VB.Label lblLabels 
				      Caption         =   "用户名:"
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   12
				         Charset         =   0
				         Weight          =   700
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      Height          =   252
				      Index           =   0
				      Left            =   348
				      TabIndex        =   2
				      Tag             =   "&User Name:"
				      Top             =   1440
				      Width           =   1080
				   End
				End
				Attribute VB_Name = "frmLogin"
				Attribute VB_GlobalNameSpace = False
				Attribute VB_Creatable = False
				Attribute VB_PredeclaredId = True
				Attribute VB_Exposed = False
				Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
				
				
				Public OK As Boolean
				Private Sub Form_Load()
				    Dim sBuffer As String
				    Dim lSize As Long
				
				
				    sBuffer = Space$(255)
				    lSize = Len(sBuffer)
				    Call GetUserName(sBuffer, lSize)
				    If lSize > 0 Then
				        txtUserName.Text = Left$(sBuffer, lSize)
				    Else
				        txtUserName.Text = vbNullString
				    End If
				End Sub
				
				
				
				Private Sub cmdCancel_Click()
				    OK = False
				    Me.Hide
				End Sub
				
				
				Private Sub cmdOK_Click()
				    'ToDo: create test for correct password
				    'check for correct password
				    Dim txtSQL As String
				    Dim mrc As ADODB.Recordset
				    Dim MsgText As String
				    'ToDo: create test for correct password
				    'check for correct password
				    
				    UserName = ""
				    If Trim(txtUserName.Text = "") Then
				        MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
				        txtUserName.SetFocus
				    Else
				        txtSQL = "select * from user_Info where user_ID = '" & txtUserName.Text & "'"
				        Set mrc = ExecuteSQL(txtSQL, MsgText)
				        If mrc.EOF = True Then
				            MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
				            txtUserName.SetFocus
				        Else
				            If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
				                OK = True
				                mrc.Close
				                Me.Hide
				                UserName = Trim(txtUserName.Text)
				            Else
				                MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
				                txtPassword.SetFocus
				                txtPassword.Text = ""
				            End If
				        End If
				    End If
				    
				    miCount = miCount + 1
				    If miCount = 3 Then
				        Me.Hide
				    End If
				    Exit Sub
				End Sub
				
				
							

相关资源