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

📄 enter.frm

📁 称重管理软件(大型地磅)源码 为农贸市场定制开发
💻 FRM
字号:
VERSION 5.00
Begin VB.Form enter 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "用户登陆"
   ClientHeight    =   1875
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   3180
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   9.75
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "enter.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1875
   ScaleWidth      =   3180
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   270
      Left            =   360
      TabIndex        =   7
      Text            =   "Text1"
      Top             =   2040
      Width           =   975
   End
   Begin VB.ComboBox Combo1 
      BackColor       =   &H00C0E0FF&
      Height          =   315
      Left            =   1200
      TabIndex        =   0
      Top             =   360
      Width           =   1695
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退  出"
      Height          =   375
      Left            =   1800
      TabIndex        =   5
      Top             =   1320
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "登  陆"
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   1320
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      BackColor       =   &H00C0E0FF&
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1200
      MaxLength       =   20
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   840
      Width           =   1695
   End
   Begin VB.Label txtadm 
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1800
      TabIndex        =   6
      Top             =   2880
      Width           =   855
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "密  码:"
      Height          =   255
      Left            =   360
      TabIndex        =   2
      Top             =   840
      Width           =   855
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "账  户:"
      Height          =   255
      Left            =   360
      TabIndex        =   1
      Top             =   360
      Width           =   975
   End
End
Attribute VB_Name = "enter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnnUser As New ADODB.Connection
Dim rstUser As New ADODB.Recordset


Private Sub Combo2_Change()

End Sub



Private Sub Command1_Click()

  Dim cc As String
  Dim jibie As String
  cc = Combo1.Text
  If cc = "" Then
    Combo1.SetFocus
    MsgBox "请输入用户名!", vbOKOnly, "输入不正确!"
    Exit Sub
  End If
  With rstUser
    If .State = adStateOpen Then .Close
     .Open ("Select * from users where name='" & cc & "'"), cnnUser, adOpenKeyset, adLockOptimistic
     If .EOF And .BOF Then
     MsgBox "请检查用户名!", vbOKOnly, "账户不正确!"
     Combo1.SetFocus
     Else
      If Trim(Combo1.Text & "") = Trim(rstUser.Fields("name").Value) And Trim(Text2.Text & "") = decipher(Trim(rstUser.Fields("password").Value)) Then
     If rstUser.Fields("adm").Value > 0 Then
     jibie = "管理员"
     op.commShanchu.Enabled = True
    op.commQingkong.Enabled = True
    op.cShanchu.Enabled = True
    op.cTianjia.Enabled = True
    op.cXg.Enabled = True
    op.cXiugai.Enabled = True
    op.txtyuan.Enabled = False
     Else
     jibie = "司磅员"
     End If
   Text2.Text = ""
   Me.Hide
    op.Label2.Caption = rstUser.Fields("name").Value
    op.Label3.Caption = jibie
    Call comm
    op.Show
   
  Else
   
    Text2.Text = ""
    Text2.SetFocus
    MsgBox "请检查密码!", vbOKOnly, "密码不正确!"

    Exit Sub
  End If
End If
     .Close
  End With

End Sub
Private Sub comm()
On Error GoTo p:
op.MSComm1.Settings = GetIni("MSCOMM", "settings", "Config.ini")
op.MSComm1.CommPort = GetIni("MSCOMM", "commport", "Config.ini")
If op.MSComm1.PortOpen = False Then
op.MSComm1.PortOpen = True
op.Timer2.Enabled = True
End If
op.Timer1.Enabled = True
Exit Sub
p:
  MsgBox "串口通信出错!", vbOKOnly, "错误:"
  End
End Sub
Private Sub Command2_Click()
End
End Sub




Private Sub Form_Load()

    Dim password As String
    Dim DB As String
    Dim ds As String
    Dim uId As String
On Error GoTo k
    
    password = GetIni("DataSource", "Password", "Config.ini")
    DB = GetIni("DataSource", "Database", "Config.ini")
    ds = GetIni("DataSource", "DataSource", "Config.ini")
    uId = GetIni("DataSource", "UserID", "Config.ini")
On Error GoTo p
  With cnnUser
    If .State = adStateOpen Then .Close
    .ConnectionString = "Provider=SQLOLEDB.1;Password=" & password & ";Persist Security Info=True;User ID=" & uId & ";Initial Catalog= " & DB & " ;Data Source=" & ds
    .Open
  End With
  Call data
  Exit Sub
p:
  MsgBox "连接不上数据库!", vbOKOnly, "错误"
  End
k:
  MsgBox "配置文件错误!", vbOKOnly, "错误"
  End
End Sub

Private Sub data()
On Error GoTo p
  With rstUser
    Set .ActiveConnection = cnnUser
    .CursorType = adOpenKeyset  'adOpenKeyset,adOpenStatic可使用Recordset的RecordCount,其他两个属性不行
  End With
  With rstUser
    If .State = adStateOpen Then .Close
    .Open "Select * from users"
    Do While Not .EOF
    Combo1.AddItem rstUser.Fields("name").Value
    'Combo1.AddItem decipher(Trim(rstUser.Fields("password").Value))
    .MoveNext
     Loop
    .Close
  End With
  Exit Sub
p:
  MsgBox "数据库读取!", vbOKOnly, "错误"
  End
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
End If
End Sub

⌨️ 快捷键说明

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