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

📄 form11.frm

📁 学生管理系统:包括查询
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form8 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "学生基本数据修改"
   ClientHeight    =   6975
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8055
   LinkTopic       =   "Form8"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6975
   ScaleWidth      =   8055
   Begin VB.Frame Frame1 
      BackColor       =   &H8000000D&
      Caption         =   "请输入要修改的学生学号"
      Height          =   1935
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   6855
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   735
         Left            =   4680
         TabIndex        =   2
         Top             =   960
         Width           =   1575
      End
      Begin VB.TextBox Text1 
         Height          =   855
         Left            =   480
         TabIndex        =   1
         Top             =   480
         Width           =   2295
      End
   End
   Begin VB.ComboBox Combo2 
      Height          =   300
      Left            =   1200
      TabIndex        =   13
      Top             =   4200
      Width           =   1935
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   1200
      TabIndex        =   12
      Top             =   3480
      Width           =   1935
   End
   Begin VB.CommandButton Command4 
      Caption         =   "退出"
      Height          =   735
      Left            =   5760
      TabIndex        =   11
      Top             =   6000
      Width           =   1335
   End
   Begin VB.CommandButton Command3 
      Caption         =   "保存"
      Height          =   855
      Left            =   2520
      TabIndex        =   10
      Top             =   5880
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "修改"
      Height          =   855
      Left            =   480
      TabIndex        =   9
      Top             =   5880
      Width           =   1095
   End
   Begin VB.TextBox Text5 
      Height          =   615
      Left            =   1200
      TabIndex        =   8
      Top             =   4920
      Width           =   2055
   End
   Begin VB.TextBox Text2 
      Height          =   735
      Left            =   1200
      TabIndex        =   7
      Top             =   2280
      Width           =   1935
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "专业"
      Height          =   975
      Left            =   480
      TabIndex        =   6
      Top             =   5040
      Width           =   975
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "血型"
      Height          =   855
      Left            =   480
      TabIndex        =   5
      Top             =   4200
      Width           =   975
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "性别"
      Height          =   855
      Left            =   480
      TabIndex        =   4
      Top             =   3480
      Width           =   1215
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "姓名"
      Height          =   735
      Left            =   480
      TabIndex        =   3
      Top             =   2640
      Width           =   1095
   End
   Begin VB.Image Image1 
      Height          =   7095
      Left            =   0
      Picture         =   "Form11.frx":0000
      Stretch         =   -1  'True
      Top             =   -120
      Width           =   8055
   End
End
Attribute VB_Name = "Form8"
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)
  Combo1.Text = mrc.Fields(2)
   Combo2.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()
Combo1.Text = "男"
Combo2.Text = "a"
Text2.Text = ""
   Combo2.AddItem "a"
   Combo2.AddItem "b"
   Combo2.AddItem "ab"
   Combo2.AddItem "o"
  Combo1.AddItem "男"
   Combo1.AddItem "女"
  
   Text5.Text = ""
End Sub

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

Private Sub Command4_Click()
Me.Enabled = False
Me.Enabled = True
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 + -