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

📄 user_m.frm

📁 Visual Basic 6.0+ Access2000设计制作图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form user_m 
   Caption         =   "Form1"
   ClientHeight    =   5400
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7995
   LinkTopic       =   "Form1"
   ScaleHeight     =   5400
   ScaleWidth      =   7995
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   615
      Index           =   4
      Left            =   5640
      TabIndex        =   15
      Top             =   1680
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      Height          =   615
      Index           =   3
      Left            =   5640
      TabIndex        =   14
      Top             =   720
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      Height          =   615
      Index           =   2
      Left            =   1680
      TabIndex        =   13
      Top             =   2520
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      Height          =   615
      Index           =   1
      Left            =   1680
      TabIndex        =   12
      Top             =   1680
      Width           =   1575
   End
   Begin VB.Frame Frame2 
      Caption         =   "修改密码"
      Height          =   4335
      Left            =   3960
      TabIndex        =   6
      Top             =   360
      Width           =   3615
      Begin VB.CommandButton Command3 
         Caption         =   "确认"
         Height          =   495
         Left            =   360
         TabIndex        =   8
         Top             =   3360
         Width           =   1215
      End
      Begin VB.CommandButton Command4 
         Caption         =   "取消"
         Height          =   495
         Left            =   2040
         TabIndex        =   7
         Top             =   3360
         Width           =   1215
      End
      Begin VB.Label Label5 
         Caption         =   "请输入新密码"
         Height          =   375
         Left            =   120
         TabIndex        =   10
         Top             =   600
         Width           =   1095
      End
      Begin VB.Label Label6 
         Caption         =   "请确认新密码"
         Height          =   375
         Left            =   120
         TabIndex        =   9
         Top             =   1560
         Width           =   1095
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "添加用户程序"
      Height          =   4335
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   3495
      Begin VB.TextBox Text1 
         Height          =   615
         Index           =   0
         Left            =   1440
         TabIndex        =   11
         Top             =   360
         Width           =   1575
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确认"
         Height          =   495
         Left            =   240
         TabIndex        =   2
         Top             =   3360
         Width           =   1095
      End
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   495
         Left            =   2040
         TabIndex        =   1
         Top             =   3360
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "请输入用户名:"
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   480
         Width           =   1335
      End
      Begin VB.Label Label2 
         Caption         =   "请输入密码:"
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   1440
         Width           =   1335
      End
      Begin VB.Label Label3 
         Caption         =   "请确认密码:"
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   2400
         Width           =   1215
      End
   End
End
Attribute VB_Name = "user_m"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
 Dim con As ADODB.Connection
Private Sub Command1_Click()
 '保存记录
    Dim myrs As New ADODB.Recordset
    myrs.Open "SELECT * FROM pwd", con, adOpenDynamic, adLockOptimistic, adCmdText
    
    If Text1(0).Text = Empty Then
        MsgBox "用户名不能为空!"
        Text1(0).SetFocus
        Exit Sub
    End If
    
    While (myrs.EOF = False)
            If Trim(myrs.Fields(0)) = Trim(Text1(0)) Then
                MsgBox "用户已经存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
                Text1(0).SetFocus
                Text1(0).Text = ""
                Text1(1).Text = ""
                Text1(2).Text = ""
                Exit Sub
            Else
                myrs.MoveNext
            End If
    Wend
    
    If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
       MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
       Text1(1).SetFocus
       Text1(1).Text = ""
       Text1(2).Text = ""
       Exit Sub
    Else
       If Text1(1).Text = "" Then
          MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
          Text1(1).SetFocus
          Text1(1).Text = ""
          Text1(2).Text = ""
       Else
          myrs.AddNew
          myrs.Fields(0) = Text1(0).Text
          myrs.Fields(1) = Text1(1).Text
          myrs.Update
          myrs.Close
          Me.Hide
          MsgBox "添加用户成功!", vbOKOnly + vbExclamation, "添加用户"
       End If
    End If
    
   ' myrs.Update     '调用Recordset对象Update方法保存数据
  '  Adodc1.Recordset.Sort = "sno"
   ' Set DataGrid1.DataSource = myrs
   ' DataGrid1.Refresh
      
        
        
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
Dim myrs As New ADODB.Recordset
    myrs.Open "SELECT * FROM pwd", con, adOpenDynamic, adLockOptimistic, adCmdText
   
    
    If Trim(Text1(3).Text) <> Trim(Text1(4).Text) Then
       MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
       Text1(1).SetFocus
       Text1(1).Text = ""
       Text1(2).Text = ""
       Exit Sub
    Else
       If Text1(3).Text = "" Then
          MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
          Text1(3).SetFocus
          Text1(3).Text = ""
          Text1(4).Text = ""
       Else
          myrs.Fields(1) = Text1(3).Text
          myrs.Update
          myrs.Close
          MsgBox "密码修改成功!", vbOKOnly + vbExclamation, "修改密码"
          Me.Hide
       End If
    End If
    
   ' myrs.Update     '调用Recordset对象Update方法保存数据
  '  Adodc1.Recordset.Sort = "sno"
   ' Set DataGrid1.DataSource = myrs
   ' DataGrid1.Refresh
      
        
        
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Form_Load()

  '创建连接,并打开
    Set con = New ADODB.Connection
    con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\图书馆管理系统\db1.mdb;Persist Security Info=False"
    con.CursorLocation = adUseClient
    con.Open
End Sub


⌨️ 快捷键说明

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