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

📄 form4.frm

📁 用VB编的学生信息管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form4 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "学生基本数据修改"
   ClientHeight    =   5310
   ClientLeft      =   45
   ClientTop       =   390
   ClientWidth     =   7425
   LinkTopic       =   "Form4"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5310
   ScaleWidth      =   7425
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   960
      TabIndex        =   13
      Top             =   2760
      Width           =   1095
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   960
      TabIndex        =   12
      Top             =   2280
      Width           =   1095
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   960
      TabIndex        =   11
      Top             =   1800
      Width           =   1095
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   960
      TabIndex        =   10
      Top             =   1200
      Width           =   1815
   End
   Begin VB.CommandButton Command4 
      Caption         =   "退出"
      Height          =   375
      Left            =   3360
      TabIndex        =   9
      Top             =   3360
      Width           =   615
   End
   Begin VB.CommandButton Command3 
      Caption         =   "保存"
      Height          =   375
      Left            =   1800
      TabIndex        =   8
      Top             =   3360
      Width           =   735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "修改"
      Height          =   375
      Left            =   360
      TabIndex        =   7
      Top             =   3360
      Width           =   855
   End
   Begin VB.Frame Frame1 
      Caption         =   "请输入要修改的学生学号"
      Height          =   855
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   5175
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   375
         Left            =   3600
         TabIndex        =   2
         Top             =   240
         Width           =   735
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   480
         TabIndex        =   1
         Top             =   240
         Width           =   1935
      End
   End
   Begin VB.Label Label1 
      Caption         =   "专业:"
      Height          =   255
      Index           =   3
      Left            =   240
      TabIndex        =   6
      Top             =   2760
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "血型:"
      Height          =   255
      Index           =   2
      Left            =   240
      TabIndex        =   5
      Top             =   2280
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "性别:"
      Height          =   255
      Index           =   1
      Left            =   240
      TabIndex        =   4
      Top             =   1800
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "姓名:"
      Height          =   255
      Index           =   0
      Left            =   240
      TabIndex        =   3
      Top             =   1320
      Width           =   495
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim conn As New ADODB.Connection
Dim mrc As New ADODB.Recordset
Private Sub Command1_Click()
  Dim txtsql As String
   txtsql = "select * from 学生基本信息表 where  "
   txtsql = txtsql & "学号=" & "'" & Trim(Text1.Text) & "'"
  Set mrc = executesql(txtsql)
   Text2.Text = mrc.Fields(1)
   Text3.Text = mrc.Fields(2)
   Text4.Text = mrc.Fields(3)
   Text5.Text = mrc.Fields(4)
End Sub
Public Function executesql(ByVal sql As String) As ADODB.Recordset
  Dim cnn As ADODB.Connection
  Dim rst As ADODB.Recordset
  Set cnn = New ADODB.Connection
  Dim stokens() As String
   stokens = Split(sql)
   cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
  If InStr(" INSERT,DELETE,UPDATE", UCase$(stokens(0))) Then
   cnn.Execute sql
  Else
  Set rst = New ADODB.Recordset
   rst.Open Trim$(sql), cnn, adOpenKeyset, adLockOptimistic
  Set executesql = rst
End If
End Function

Private Sub Command2_Click()
  Text2.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   Text5.Text = ""
End Sub

Private Sub Command3_Click()
   mrc.Fields(1).Value = Text2.Text
   mrc.Fields(2).Value = Text3.Text
   mrc.Fields(3).Value = Text4.Text
   mrc.Fields(4).Value = Text5.Text
   mrc.Update
End Sub

Private Sub Command4_Click()
 Me.Hide
End Sub

Private Sub Form_Load()
  connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
  conn.Open connstr
End Sub


⌨️ 快捷键说明

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