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

📄 modclass.frm

📁 简单的数据库系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form modclass 
   Caption         =   "修改班级"
   ClientHeight    =   3960
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8730
   Icon            =   "modclass.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   3960
   ScaleWidth      =   8730
   Begin VB.TextBox Text1 
      Height          =   495
      Index           =   3
      Left            =   4320
      TabIndex        =   14
      Top             =   1440
      Width           =   1935
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Index           =   2
      Left            =   4320
      TabIndex        =   13
      Top             =   720
      Width           =   1935
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Index           =   1
      Left            =   1560
      TabIndex        =   12
      Top             =   1440
      Width           =   1935
   End
   Begin VB.CommandButton Command10 
      Caption         =   "关闭(&C)"
      Height          =   495
      Left            =   6960
      TabIndex        =   11
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton Command9 
      Caption         =   "取消(&E)"
      Height          =   495
      Left            =   6960
      TabIndex        =   10
      Top             =   2400
      Width           =   1215
   End
   Begin VB.CommandButton Command8 
      Caption         =   "查询(&Q)"
      Height          =   495
      Left            =   6960
      TabIndex        =   9
      Top             =   1920
      Width           =   1215
   End
   Begin VB.CommandButton Command7 
      Caption         =   "更新(&R)"
      Height          =   495
      Left            =   6960
      TabIndex        =   8
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton Command6 
      Caption         =   "删除(&D)"
      Height          =   495
      Left            =   6960
      TabIndex        =   7
      Top             =   960
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "编辑(&M)"
      Height          =   495
      Left            =   6960
      TabIndex        =   6
      Top             =   480
      Width           =   1215
   End
   Begin VB.Frame Frame2 
      Height          =   3255
      Left            =   6840
      TabIndex        =   5
      Top             =   240
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Height          =   855
      Left            =   480
      TabIndex        =   0
      Top             =   2640
      Width           =   6135
      Begin VB.CommandButton Command4 
         Caption         =   "最后一条记录"
         Height          =   495
         Left            =   4320
         TabIndex        =   4
         Top             =   240
         Width           =   1455
      End
      Begin VB.CommandButton Command3 
         Caption         =   "上一条记录"
         Height          =   495
         Left            =   2880
         TabIndex        =   3
         Top             =   240
         Width           =   1455
      End
      Begin VB.CommandButton Command2 
         Caption         =   "下一条记录"
         Height          =   495
         Left            =   1560
         TabIndex        =   2
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton Command1 
         Caption         =   "第一条记录"
         Height          =   495
         Left            =   240
         TabIndex        =   1
         Top             =   240
         Width           =   1335
      End
   End
End
Attribute VB_Name = "modclass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mybookmark As Variant

Private Sub Command1_Click()
    Command3.Enabled = True
    dream.MoveFirst '移动到数据集的第一条记录
    Call viewdata '调用显示数据的函数
    MsgBox "这是条一条记录!", 48, "注意!"
End Sub

Private Sub Command2_Click()
 Command3.Enabled = True
  dream.MoveNext  '数据集向后移动一条记录
 If dream.EOF Then '判断是否终止位置
    dream.MoveFirst
 End If
 Call viewdata
End Sub

Private Sub Command3_Click()
    Command2.Enabled = True
    dream.MovePrevious '数据集向前移动一条记录
    If dream.BOF Then  '判断是否到起始位置
        dream.MoveLast
    End If
    Call viewdata
End Sub

Private Sub Command4_Click()
   Command2.Enabled = False
   dream.MoveLast '移动到数据集的最后一条记录
    Call viewdata
    MsgBox "这是最后一条记录!", 48, "注意!"
End Sub

Private Sub Command10_Click()
  Unload Me
  studentmdi.StatusBar1.Panels.Item(1).Text = " "
End Sub

Private Sub Command5_Click()
If Command5.Caption = "编辑(&M)" Then
    Text1(0).Enabled = True
    Text1(1).Enabled = True
    Text1(2).Enabled = True
    Text1(3).Enabled = True
    Command1.Enabled = True
    Command2.Enabled = True
    Command3.Enabled = True
    Command4.Enabled = True
    mybookmark = dream.Bookmark  '记下当前记录位置
  End If
End Sub

Private Sub Command6_Click()
  mybookmark = dream.Bookmark
    str2$ = MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录")
    If str2$ = vbOK Then
            dream.MoveNext
            If dream.EOF Then   'recordset is empty?
                dream.MoveFirst
                mybookmark = dream.Bookmark  'sign current position
                dream.MoveLast
                dream.Delete
                dream.Close
                
                txtSQL = "select * from class"
                Set dream = ExecuteSQL(txtSQL, Msgtext)
                dream.MoveLast
                Call viewdata
            Else
                mybookmark = dream.Bookmark 'sign current position
                dream.MovePrevious
                dream.Delete
                dream.Close
                
                txtSQL = "select * from class"
                Set dream = ExecuteSQL(txtSQL, Msgtext)
                dream.MoveLast
                Call viewdata
            End If
    Else
        dream.Bookmark = mybookmark 'return primary position
        Call viewdata
    End If
End Sub

Private Sub Command7_Click()
    Command1.Enabled = False
    Command2.Enabled = False
    Command3.Enabled = False
    Command4.Enabled = False
    
    If dream.EOF = False Then
      
       MsgBox "真的要更新吗?", vbOKCancel + vbExclamation, "警告"
              'record current position
              dream.Bookmark = mybookmark  'return to current modifty position
              dream.Delete
              
              txtSQL = "select * from class "
              Set dream = ExecuteSQL(txtSQL, Msgtext)
             
             dream.Bookmark = mybookmark  'return to current modifty position
    
            dream.AddNew
    dream.Fields(0) = Trim(Text1(0).Text)
    dream.Fields(1) = Trim(Text1(1).Text)
    dream.Fields(2) = Trim(Text1(2).Text)
    dream.Fields(3) = Trim(Text1(3).Text)
    dream.UpdateBatch
    dream.Close
    '==============================
   End If
End Sub

Private Sub Command8_Click()
    dream.Bookmark = mybookmark
    Call viewdata
End Sub

Private Sub Command9_Click()
    dream.Bookmark = mybookmark
    Call viewdata
End Sub

Private Sub Form_Load()
txtSQL = "select * from class "
     Set dream = ExecuteSQL(txtSQL, Msgtext) '执行查询操作
       dream.MoveFirst   '移到第一条记录
       Call viewdata     '显示记录
    mcbookmark = dream.Bookmark '记下当前记录的位置
    Text1(0).Enabled = False
    Text1(1).Enabled = False
    Text1(2).Enabled = False
    Text1(3).Enabled = False
    modclass.Height = 4365
    modclass.Width = 8850
    modclass.Caption = "修改班级信息.....[" + Format(Date, "yyyy年mm月dd日]")
    studentmdi.StatusBar1.Panels.Item(1).Text = "修改班级信息"
End Sub

Public Sub viewdata()       '由于程序中各处需要显示数据,定义函数ViewData
    Text1(0).Text = dream.Fields(0)
    Text1(1).Text = dream.Fields(1)
    Text1(2).Text = dream.Fields(2)
    Text1(3).Text = dream.Fields(3)
End Sub





⌨️ 快捷键说明

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