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

📄 modstudgo.frm

📁 简单的数据库系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Top             =   3960
      Width           =   1215
   End
   Begin VB.CommandButton Command9 
      Caption         =   "取消(&E)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   9000
      TabIndex        =   10
      Top             =   3240
      Width           =   1215
   End
   Begin VB.CommandButton Command8 
      Caption         =   "查询(&Q)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   9000
      TabIndex        =   9
      Top             =   2520
      Width           =   1215
   End
   Begin VB.CommandButton Command7 
      Caption         =   "更新(&R)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   9000
      TabIndex        =   8
      Top             =   1800
      Width           =   1215
   End
   Begin VB.CommandButton Command6 
      Caption         =   "删除(&D)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   9000
      TabIndex        =   7
      Top             =   1080
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "编辑(&M)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   9000
      TabIndex        =   6
      Top             =   360
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "最后一条记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   6120
      TabIndex        =   5
      Top             =   6120
      Width           =   2055
   End
   Begin VB.CommandButton Command3 
      Caption         =   "上一条记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   4200
      TabIndex        =   4
      Top             =   6120
      Width           =   1935
   End
   Begin VB.CommandButton Command2 
      Caption         =   "下一条记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   2280
      TabIndex        =   3
      Top             =   6120
      Width           =   1935
   End
   Begin VB.CommandButton Command1 
      Caption         =   "第一条记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   480
      TabIndex        =   2
      Top             =   6120
      Width           =   1815
   End
   Begin VB.Frame Frame2 
      Height          =   4815
      Left            =   8760
      TabIndex        =   1
      Top             =   120
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      Height          =   975
      Left            =   120
      TabIndex        =   0
      Top             =   5880
      Width           =   8415
   End
End
Attribute VB_Name = "modstudgo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Dim mybookmark As Variant

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

Private Sub Command10_Click()
studentmdi.StatusBar1.Panels.Item(1).Text = " "
Unload Me
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()
    dream.MovePrevious '数据集向前移动一条记录
    If dream.BOF Then  '判断是否到起始位置
        dream.MoveLast
    End If
    Call viewdata
End Sub

Private Sub Command4_Click()
    Command3.Enabled = True
    dream.MoveLast '移动到数据集的最后一条记录
    Call viewdata
    MsgBox "这是最后一条记录!", 48, "注意!"
End Sub
Private Sub Command11_Click()
If Command11.Caption = "搜索(&S)" Then
   If Not Testtxt(Text8.Text) Then
      MsgBox "请输入学号!", 48, "提示"
      Text8.SetFocus
  Else
     txtSQL = "select * from studentgo where  编号 like '%" & Text8.Text & "'OR 姓名 like '" & Text8.Text & "'"
     Set dream = ExecuteSQL(txtSQL, Msgtext)
     Call viewdata
  End If
End If
End Sub



Private Sub Command5_Click()
If Command5.Caption = "编辑(&M)" Then
    Text1.Enabled = True
    Text2.Enabled = True
    Combo1.Enabled = True
    Combo2.Enabled = True
    Text3.Enabled = True
    Text4.Enabled = True
    Text5.Enabled = True
    Text6.Enabled = True
    Text7.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 studentgo"
                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 studentgo"
                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 studentgo  "
              Set dream = ExecuteSQL(txtSQL, Msgtext)
              
    dream.Bookmark = mybookmark  'return to current modifty position
    dream.AddNew
    dream.Fields(0) = Trim(Text1.Text)
    dream.Fields(1) = Trim(Text2.Text)
    dream.Fields(2) = Trim(Combo1.Text)
    dream.Fields(3) = Trim(Text3.Text)
    dream.Fields(4) = Trim(Combo2.Text)
    dream.Fields(5) = Trim(Text4.Text)
    dream.Fields(6) = Trim(Text5.Text)
    dream.Fields(7) = Trim(Text6.Text)
    dream.Fields(8) = Trim(Text7.Text)
    dream.Update
    dream.Close
   End If
End Sub

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

'=============================================================
Private Sub Form_Load()
   modstudgo.Width = 10920
   modstudgo.Height = 7665
   Combo1.AddItem "男"
   Combo1.AddItem "女"
   Combo1.AddItem "是"
   Combo2.AddItem "否"
   
   txtSQL = "select * from studentgo "
   Set dream = ExecuteSQL(txtSQL, Msgtext) '执行查询操作
   dream.MoveFirst   '移到第一条记录
   Call viewdata     '显示记录
   mybookmark = dream.Bookmark '记下当前记录的位置 mcbookmark------mybookmrk
       Text1.Enabled = False
       Text2.Enabled = False
       Combo1.Enabled = False
       Combo2.Enabled = False
       Text3.Enabled = False
       Text4.Enabled = False
       Text5.Enabled = False
       Text6.Enabled = False
       Text7.Enabled = False
       modstudgo.Caption = "修改毕业生信息[" + Format(Date, "yyyy年mm月dd日") + Format(Time, "hh点mm分ss秒]")
       studentmdi.StatusBar1.Panels.Item(1).Text = "修改毕业生信息"
 End Sub
 
Public Sub viewdata()       '由于程序中各处需要显示数据,定义函数ViewData

    Text1.Text = dream.Fields(0)
    Text2.Text = dream.Fields(1)
    Combo1.Text = dream.Fields(2)
    Text3.Text = dream.Fields(3)
    Combo2.Text = dream.Fields(4)
    Text4.Text = dream.Fields(5)
    Text5.Text = dream.Fields(6)
    Text6.Text = dream.Fields(7)
    Text7.Text = dream.Fields(8)
End Sub


Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  Text5.SetFocus
End If
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  Text4.SetFocus
End If
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  Text6.SetFocus
End If
End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  Text7.SetFocus
End If
End Sub

Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  Text2.SetFocus
End If
End Sub




⌨️ 快捷键说明

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