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

📄 form21.frm

📁 vb开发的房屋管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form 添加用户 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加用户"
   ClientHeight    =   3030
   ClientLeft      =   2475
   ClientTop       =   2250
   ClientWidth     =   5760
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3030
   ScaleWidth      =   5760
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   495
      Left            =   240
      Top             =   8160
      Visible         =   0   'False
      Width           =   9735
      _ExtentX        =   17171
      _ExtentY        =   873
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      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.CommandButton cmdclose 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   4440
      TabIndex        =   7
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton cmdcancel 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   3000
      TabIndex        =   6
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton cmdupdate 
      Caption         =   "保存"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1560
      TabIndex        =   5
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton cmdadd 
      Caption         =   "添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   120
      TabIndex        =   4
      Top             =   2040
      Width           =   1215
   End
   Begin VB.TextBox txtfield 
      Height          =   375
      Index           =   1
      Left            =   2160
      TabIndex        =   3
      Top             =   1080
      Width           =   2175
   End
   Begin VB.TextBox txtfield 
      Height          =   375
      Index           =   0
      Left            =   2160
      TabIndex        =   0
      Top             =   360
      Width           =   2175
   End
   Begin VB.Frame Frame1 
      Caption         =   "添加功能"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFF00&
      Height          =   1335
      Left            =   0
      TabIndex        =   8
      Top             =   1680
      Width           =   5775
   End
   Begin VB.Label Label2 
      Caption         =   "密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1200
      TabIndex        =   2
      Top             =   1080
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "用户名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1080
      TabIndex        =   1
      Top             =   360
      Width           =   855
   End
End
Attribute VB_Name = "添加用户"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub setbuttons(bval As Boolean)
  cmdadd.Enabled = bval
  cmdupdate.Enabled = Not bval
  cmdcancel.Enabled = Not bval
  cmdclose.Enabled = bval
  
End Sub

Private Sub cmdadd_Click()
  On Error GoTo adderr
  Adodc1.Recordset.AddNew
  setbuttons False
  Exit Sub
adderr:
  MsgBox Err.Description
End Sub

Private Sub cmdcancel_Click()
  On Error GoTo cancelerr
  Adodc1.Recordset.CancelBatch adAffectAll
  setbuttons True
  MsgBox "取消成功", vbExclamation + vbOKOnly, "添加入库"
  Exit Sub
  
cancelerr:
  MsgBox Err.Description

End Sub

Private Sub cmdclose_Click()
管理员界面.Show
Unload Me
 
End Sub

Private Sub cmdupdate_Click()
 On Error GoTo updateerr
 If Trim(txtfield(0).Text) = "" Then
    MsgBox " 用户名不能为空", vbExclamation + vbOKOnly, "警告"
    txtfield(0).SetFocus
    Exit Sub
    End If
    
     If Trim(txtfield(1).Text) = "" Then
    MsgBox " 密码不能为空", vbExclamation + vbOKOnly, "警告"
    txtfield(1).SetFocus
    Exit Sub
    End If

    
   Adodc1.Recordset.UpdateBatch adAffectAll
   setbuttons True
   MsgBox "保存成功!", vbExclamation + vbOKOnly, "添加入库"
   Adodc1.Refresh
   DataGrid1.Refresh
   Exit Sub
   
updateerr:
    MsgBox Err.Description
    
  
   
End Sub

Private Sub Form_Load()
 
  Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=peter"
  Adodc1.CommandType = adCmdText
  Adodc1.RecordSource = " select * from 密码表"
  Adodc1.Refresh
   Dim i As Integer
  For i = 1 To 2
      Set txtfield(i - 1).DataSource = Adodc1
    txtfield(i - 1).DataField = Adodc1.Recordset.Fields(i - 1).Name
   Next i
   setbuttons True


 
End Sub

⌨️ 快捷键说明

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