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

📄 form2.frm

📁 一个数据库课程设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   Caption         =   "登记"
   ClientHeight    =   4800
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9270
   LinkTopic       =   "Form2"
   ScaleHeight     =   47.935
   ScaleMode       =   0  'User
   ScaleWidth      =   92.457
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   1215
      Index           =   4
      Left            =   6240
      TabIndex        =   5
      Text            =   "Text1"
      Top             =   960
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   1335
      Left            =   360
      TabIndex        =   4
      Top             =   2760
      Width           =   3015
   End
   Begin VB.TextBox Text1 
      Height          =   1215
      Index           =   3
      Left            =   4800
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   840
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   1215
      Index           =   2
      Left            =   3240
      TabIndex        =   2
      Text            =   "Text1"
      Top             =   840
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   1215
      Index           =   1
      Left            =   1560
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   720
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   1215
      Index           =   0
      Left            =   240
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   840
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "类别"
      Height          =   375
      Index           =   4
      Left            =   6360
      TabIndex        =   10
      Top             =   240
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "工作电话"
      Height          =   375
      Index           =   3
      Left            =   4680
      TabIndex        =   9
      Top             =   240
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "名字"
      Height          =   375
      Index           =   2
      Left            =   3120
      TabIndex        =   8
      Top             =   120
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "地址"
      Height          =   375
      Index           =   1
      Left            =   1680
      TabIndex        =   7
      Top             =   240
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "单位"
      Height          =   375
      Index           =   0
      Left            =   240
      TabIndex        =   6
      Top             =   240
      Width           =   1095
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()

  Dim DBConn As ADODB.Connection
  Dim DBRst As ADODB.Recordset
  Dim SqlText As String
  
  Set DBConn = CreateObject("ADODB.Connection")
  Set DBRst = CreateObject("ADODB.Recordset")
  
  DBConn.ConnectionString = "DBQ=" + App.Path + "\db1.mdb;Driver={Microsoft Access Driver (*.mdb)}"
  DBConn.Open
  
  Set DBRst.ActiveConnection = DBConn
  SqlText = "Select * from data where num is null "
    DBRst.Open SqlText, , 2, 3 'Open recordset.
  
  DBRst.AddNew
  DBRst("dep") = Text1(0).Text
  DBRst("add") = Text1(1).Text
  DBRst("name") = Text1(2).Text
  DBRst("mobile") = Text1(3).Text
  DBRst("style") = Text1(4).Text
  DBRst.Update
  
  MsgBox "操作成功!!!"
  
  DBRst.Close
  DBConn.Close
  
End Sub

⌨️ 快捷键说明

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