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

📄 form1.frm

📁 实现对数据库添加
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6855
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9780
   LinkTopic       =   "Form1"
   ScaleHeight     =   6855
   ScaleWidth      =   9780
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command5 
      Caption         =   "修改"
      Height          =   735
      Left            =   6240
      TabIndex        =   10
      Top             =   4680
      Width           =   2535
   End
   Begin VB.TextBox Text6 
      DataField       =   "标准答案"
      DataSource      =   "Data1"
      Height          =   615
      Left            =   720
      TabIndex        =   9
      Text            =   "Text6"
      Top             =   3840
      Width           =   3495
   End
   Begin VB.TextBox Text5 
      DataField       =   "选项D"
      DataSource      =   "Data1"
      Height          =   855
      Left            =   3360
      TabIndex        =   8
      Text            =   "Text5"
      Top             =   2760
      Width           =   1815
   End
   Begin VB.TextBox Text4 
      DataField       =   "选项B"
      DataSource      =   "Data1"
      Height          =   855
      Left            =   3360
      TabIndex        =   7
      Text            =   "Text4"
      Top             =   1560
      Width           =   1815
   End
   Begin VB.TextBox Text3 
      DataField       =   "选项C"
      DataSource      =   "Data1"
      Height          =   855
      Left            =   600
      TabIndex        =   6
      Text            =   "Text3"
      Top             =   2760
      Width           =   1815
   End
   Begin VB.TextBox Text2 
      DataField       =   "选项A"
      DataSource      =   "Data1"
      Height          =   855
      Left            =   600
      TabIndex        =   5
      Text            =   "Text2"
      Top             =   1560
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      DataField       =   "题目"
      DataSource      =   "Data1"
      Height          =   975
      Left            =   240
      TabIndex        =   4
      Text            =   "Text1"
      Top             =   240
      Width           =   6975
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access 2000;"
      DatabaseName    =   "C:\Documents and Settings\zkl\桌面\timu.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   735
      Left            =   2280
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "timu"
      Top             =   5640
      Width           =   3735
   End
   Begin VB.CommandButton Command4 
      Caption         =   "退出"
      Height          =   615
      Left            =   4440
      TabIndex        =   3
      Top             =   4680
      Width           =   1335
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删除"
      Height          =   495
      Left            =   2760
      TabIndex        =   2
      Top             =   4680
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "添加"
      Height          =   495
      Left            =   1440
      TabIndex        =   1
      Top             =   4680
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查找"
      Height          =   495
      Left            =   360
      TabIndex        =   0
      Top             =   4680
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
Data1.Recordset.AddNew

Text1.SetFocus
Data1.Recordset.Fields("题目") = Text1.Text
Data1.Recordset.Fields("选项A") = Text2.Text
Data1.Recordset.Fields("选项B") = Text3.Text
Data1.Recordset.Fields("选项C") = Text4.Text
Data1.Recordset.Fields("选项D") = Text5.Text
Data1.Recordset.Fields("标准答案") = Text6.Text


End Sub

Private Sub Command3_Click()
Data1.Recordset.Delete
If Data1.Recordset.EOF() Then
   Data1.Recordset.MoveLast
 Else
    Data1.Recordset.MoveNext
 End If
 Data1.Refresh

End Sub

Private Sub Command4_Click()
Data1.Recordset.Close

End
End Sub

Private Sub Command5_Click()
Data1.Recordset.Edit
Text1.SetFocus
Text2.SetFocus
Text3.SetFocus
Text4.SetFocus
Text5.SetFocus
End Sub

⌨️ 快捷键说明

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