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

📄 frmstudent.frm

📁 图书管理系统,图书信息,添加学生信息,借书与归还记载,借书卡办理,查询图书信息
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1560
      TabIndex        =   6
      Top             =   2160
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1560
      TabIndex        =   2
      Top             =   360
      Width           =   1695
   End
   Begin VB.CommandButton cmd_add 
      Caption         =   "添加"
      Height          =   495
      Left            =   240
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   2880
      Width           =   1215
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "备注"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   4080
      TabIndex        =   5
      Top             =   240
      Width           =   420
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "学院"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   240
      TabIndex        =   4
      Top             =   1200
      Width           =   420
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "姓名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   240
      TabIndex        =   3
      Top             =   2160
      Width           =   420
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "学号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   240
      TabIndex        =   1
      Top             =   360
      Width           =   420
   End
End
Attribute VB_Name = "frmstudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim j As Integer         '用于FOR循环中的变量
Dim StrNum As Long       '定义一个用于保存编号信息的变量
Dim j1, j2, j3 As Integer
Dim xx As String '定义保存选中要删除设备数量的变量
Dim count1 As Integer '控制全局变量count2只能获得最旧值
Dim c
'*** “修改”供应商信息按钮的事件过程 ***
Private Sub Cmd_edit_Click()
   If Text1.Text = "" Or Text2.Text = "" Then
      MsgBox "请选择需要改动的记录信息!", 48, "信息提示"
   Else
        c = MsgBox("确认要修改该记录吗?", 33, "修改信息提示")
           If c = vbOK Then                                   '如果确认修改的话进行修改操作
               If Text1.Text = "" Then
                  MsgBox "学号不能为空值!", 48, "修改信息提示"
               Else
                          Call main     '调用公共模块中的连接数据库函数
                            '利用SQL语句修改供应商信息
                            Set adoRs = adoCon.Execute("UPDATE 学生表 SET 学号='" + Text1.Text + "',姓名='" + Text2.Text + "',学院='" + Text3.Text + "',备注='" + Text4.Text + "'  where 学号='" + Text1 + "'")
                            MsgBox "信息修改成功", 64, "修改信息提示"
                            cmd_edit.Enabled = False
                          adoCon.Close                  '关闭数据连接
                          Call TRefresh                 '调用数据刷新过程
                End If
            Else
            End If
   End If
End Sub

'*** “添加”供应商信息按钮的事件过程 ***
Private Sub Cmd_Add_Click()
'On Error Resume Next
    Adodc1.RecordSource = "select * from 学生表 order by 学号"
    Adodc1.Refresh
  Text1.Text = "": Text2.Text = "": Text3.Text = "": Text4.Text = ""
   Text1.SetFocus
   cmd_save.Enabled = True
   cmd_del.Enabled = False
 
End Sub
'*** “删除”供应商信息按钮的事件过程 ***
Private Sub Cmd_del_Click()
If Text1.Text = "" Then
   MsgBox "请选择您要删除的记录!", 48, "提示"
   Exit Sub
End If
If Adodc1.Recordset.EOF = False Then
            c = MsgBox("您确认要删除该记录吗?", 17, "删除提示信息")
            If c = vbOK Then
                   Adodc1.Recordset.Delete     '删除所选中的记录信息
                   Adodc1.Refresh
                   
                   cmd_del.Enabled = False
            End If
            
  
    End If
    Call TRefresh                                                                 '调用数据刷新过程
End Sub

Private Sub cmd_exit_Click()
  Unload Me
End Sub
'*** “保存”供应商信息按钮的事件过程 ***
Private Sub Cmd_save_Click()
        c = MsgBox("您确认要保存该信息吗?", 33, "保存信息提示")
          If c = vbOK Then
               '限制输入的部分信息不能为空值
               If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
                      MsgBox "输入信息不完全!", 48, "保存信息提示"
               Else
                      'IsNumeric函数用于判断输入的信息是否为数值型数据
                      
                            Call main                  '调用公共模块中的连接数据库过程
                            
                               Set adoRs = adoCon.Execute("insert into 学生表 values('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "')")
                                                       
                                 MsgBox "信息保存成功", 64, "保存信息提示"
                                 cmd_save.Enabled = False
                                 Call TRefresh                                    '调用数据刷新过程
                             adoCon.Close
                     End If
                End If

     Call TRefresh                                                                 '调用数据刷新过程
End Sub



Private Sub Command1_Click()

frmbanka.Text1.Text = Text1.Text
frmjieshu.Text1.Text = Text1.Text
Unload Me
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer) '''这个东西在单击了添加时也会执行,为什么?
  Call JionBack                                        '调用数据信息反绑定过程
  cmd_del.Enabled = True
  cmd_edit.Enabled = True
  cmd_save.Enabled = False
End Sub
Private Sub Form_Load()

   Me.Left = (Screen.Width - Me.Width) / 2
   Me.Top = (Screen.Height - Me.Height) / 2
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
End Sub
'*** 自定义数据信息反绑定的过程 ***
Private Sub JionBack()
On Error Resume Next     '执行错误处理
Dim SLen As Integer
  If Adodc1.Recordset.RecordCount > 0 Then
      
     '将数据信息反绑定到文本框当中
     Text1.Text = Trim(Adodc1.Recordset(0)) 'trim太重要了,这个地方由于长度设死了,而'''''''哈哈;;;;;;;;;;'
     Text2.Text = Trim(Adodc1.Recordset(1))
     Text3.Text = Trim(Adodc1.Recordset(2))
     Text4.Text = Trim(Adodc1.Recordset(3))
  End If
End Sub
'*** 自定义数据刷新的过程 ***
Private Sub TRefresh()
    Adodc1.RecordSource = "select * from 学生表"
    Adodc1.Refresh
End Sub

⌨️ 快捷键说明

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