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

📄 adduser.frm

📁 一个简单的数据库操作例子,特别适合初学者.vb数据库编程练习
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form 添加用户 
   Caption         =   "添加用户"
   ClientHeight    =   3765
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5580
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3765
   ScaleWidth      =   5580
   StartUpPosition =   1  '所有者中心
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   240
      Top             =   2880
      Visible         =   0   'False
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   582
      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         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=order.mdb;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=order.mdb;Persist Security Info=False"
      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.CheckBox Check4 
      Caption         =   "Check4"
      Height          =   255
      Left            =   3000
      TabIndex        =   10
      Top             =   2280
      Width           =   975
   End
   Begin VB.CheckBox Check3 
      Caption         =   "Check3"
      Height          =   255
      Left            =   1560
      TabIndex        =   9
      Top             =   2280
      Width           =   855
   End
   Begin VB.CheckBox Check2 
      Caption         =   "Check2"
      Height          =   255
      Left            =   3000
      TabIndex        =   8
      Top             =   1800
      Width           =   975
   End
   Begin VB.CheckBox Check1 
      Caption         =   "Check1"
      Height          =   255
      Left            =   1560
      TabIndex        =   7
      Top             =   1800
      Width           =   1095
   End
   Begin VB.CommandButton Command2 
      Caption         =   "保存"
      Default         =   -1  'True
      Height          =   375
      Left            =   1920
      TabIndex        =   5
      Top             =   3120
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "取消"
      Height          =   375
      Left            =   3000
      TabIndex        =   4
      Top             =   3120
      Width           =   735
   End
   Begin VB.TextBox Text2 
      Height          =   320
      Left            =   3480
      TabIndex        =   1
      Top             =   600
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      Height          =   320
      Left            =   1200
      TabIndex        =   0
      Top             =   600
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "权限设置"
      Height          =   255
      Left            =   600
      TabIndex        =   6
      Top             =   1560
      Width           =   735
   End
   Begin VB.Line Line1 
      X1              =   240
      X2              =   5280
      Y1              =   1320
      Y2              =   1320
   End
   Begin VB.Label Label2 
      Caption         =   "密码"
      Height          =   255
      Left            =   3000
      TabIndex        =   3
      Top             =   640
      Width           =   375
   End
   Begin VB.Label Label1 
      Caption         =   "用户名"
      Height          =   255
      Left            =   550
      TabIndex        =   2
      Top             =   645
      Width           =   615
   End
End
Attribute VB_Name = "添加用户"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command2_Click()
If Text1 = "" Then
MsgBox "对不起,用户名不能为空!", 48, "信息提示"
ElseIf Text2 = "" Then
MsgBox "对不起,密码不能为空!", 48, "信息提示"
Else
Adodc1.RecordSource = "select * from 管理员"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("name") = Trim(Text1.Text)
Adodc1.Recordset.Fields("password") = Trim(Text2.Text)
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox "添加成功,请点确定返回", 64, "信息提示"
Unload Me
End If
End Sub

⌨️ 快捷键说明

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