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

📄 frmstudentupdate.frm

📁 这是别人的数据库课程设计
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form FrmStudentUpdate 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "学生信息修改"
   ClientHeight    =   5670
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6060
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5670
   ScaleWidth      =   6060
   Begin VB.Frame Frame1 
      Caption         =   "学生信息修改"
      Height          =   5535
      Left            =   135
      TabIndex        =   0
      Top             =   45
      Width           =   5775
      Begin VB.TextBox txtID 
         Height          =   270
         Left            =   720
         Locked          =   -1  'True
         TabIndex        =   17
         Text            =   "txtID"
         Top             =   360
         Width           =   2055
      End
      Begin VB.TextBox txtName 
         Height          =   270
         Left            =   3360
         TabIndex        =   16
         Text            =   "txtName"
         Top             =   360
         Width           =   2295
      End
      Begin VB.ComboBox cobSex 
         Height          =   300
         Left            =   720
         Style           =   2  'Dropdown List
         TabIndex        =   15
         Top             =   720
         Width           =   1095
      End
      Begin VB.ComboBox cobNation 
         Height          =   300
         Left            =   720
         Style           =   2  'Dropdown List
         TabIndex        =   13
         Top             =   1080
         Width           =   1095
      End
      Begin VB.ComboBox cobSpeciality 
         Height          =   300
         Left            =   2400
         Style           =   2  'Dropdown List
         TabIndex        =   12
         Top             =   1080
         Width           =   3255
      End
      Begin VB.TextBox txtPhone 
         Height          =   270
         Left            =   720
         TabIndex        =   11
         Text            =   "txtPhone"
         Top             =   1440
         Width           =   4935
      End
      Begin VB.TextBox txtStatusID 
         Height          =   270
         Left            =   1080
         TabIndex        =   10
         Text            =   "txtStatusID"
         Top             =   1800
         Width           =   4575
      End
      Begin VB.TextBox txtEmail 
         Height          =   270
         Left            =   1080
         TabIndex        =   9
         Text            =   "txtEmail"
         Top             =   2160
         Width           =   4575
      End
      Begin VB.TextBox txtHouseName 
         Height          =   270
         Left            =   1080
         TabIndex        =   8
         Text            =   "txtHouseName"
         Top             =   2520
         Width           =   2055
      End
      Begin VB.TextBox txtHousePhone 
         Height          =   270
         Left            =   1080
         TabIndex        =   7
         Text            =   "txtHousePhone"
         Top             =   2880
         Width           =   4575
      End
      Begin VB.TextBox txtHouseAddress 
         Height          =   270
         Left            =   1080
         TabIndex        =   6
         Text            =   "txtHouseAddress"
         Top             =   3240
         Width           =   4575
      End
      Begin VB.TextBox txtPostCode 
         Height          =   270
         Left            =   1080
         TabIndex        =   5
         Text            =   "txtPostCode"
         Top             =   3600
         Width           =   2055
      End
      Begin VB.TextBox txtMemo 
         Height          =   975
         IMEMode         =   3  'DISABLE
         Left            =   1080
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   4
         Text            =   "FrmStudentUpdate.frx":0000
         Top             =   3960
         Width           =   4575
      End
      Begin VB.CommandButton cmdUpdate 
         Caption         =   "确认修改"
         Height          =   375
         Left            =   405
         TabIndex        =   3
         Top             =   5040
         Width           =   1095
      End
      Begin VB.CommandButton cmdCancel 
         Caption         =   "取消修改"
         Default         =   -1  'True
         Height          =   375
         Left            =   2280
         TabIndex        =   2
         Top             =   5040
         Width           =   1095
      End
      Begin VB.CommandButton cmdQuit 
         Cancel          =   -1  'True
         Caption         =   "返回系统"
         Height          =   375
         Left            =   4275
         TabIndex        =   1
         Top             =   5040
         Width           =   1095
      End
      Begin MSComCtl2.DTPicker dtBirthday 
         Height          =   255
         Left            =   2880
         TabIndex        =   14
         Top             =   720
         Width           =   2775
         _ExtentX        =   4895
         _ExtentY        =   450
         _Version        =   393216
         Format          =   23789568
         CurrentDate     =   37205
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "学号:"
         Height          =   180
         Left            =   240
         TabIndex        =   31
         Top             =   360
         Width           =   540
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "姓名:"
         Height          =   180
         Left            =   2880
         TabIndex        =   30
         Top             =   360
         Width           =   540
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "性别:"
         Height          =   180
         Left            =   240
         TabIndex        =   29
         Top             =   720
         Width           =   540
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "出生日期:"
         Height          =   180
         Left            =   1920
         TabIndex        =   28
         Top             =   720
         Width           =   900
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "民族:"
         Height          =   180
         Left            =   240
         TabIndex        =   27
         Top             =   1080
         Width           =   540
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "专业:"
         Height          =   180
         Left            =   1920
         TabIndex        =   26
         Top             =   1080
         Width           =   540
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "电话:"
         Height          =   180
         Left            =   240
         TabIndex        =   25
         Top             =   1440
         Width           =   540
      End
      Begin VB.Label Label10 
         AutoSize        =   -1  'True
         Caption         =   "身份证号:"
         Height          =   180
         Left            =   240
         TabIndex        =   24
         Top             =   1800
         Width           =   900
      End
      Begin VB.Label Label11 
         AutoSize        =   -1  'True
         Caption         =   "电子信箱:"
         Height          =   180
         Left            =   240
         TabIndex        =   23
         Top             =   2160
         Width           =   900
      End
      Begin VB.Label Label12 
         AutoSize        =   -1  'True
         Caption         =   "家长姓名:"
         Height          =   180
         Left            =   240
         TabIndex        =   22
         Top             =   2520
         Width           =   900
      End
      Begin VB.Label Label13 
         AutoSize        =   -1  'True
         Caption         =   "家长电话:"
         Height          =   180
         Left            =   240
         TabIndex        =   21
         Top             =   2880
         Width           =   900
      End
      Begin VB.Label Label14 
         AutoSize        =   -1  'True
         Caption         =   "家长地址:"
         Height          =   180
         Left            =   240
         TabIndex        =   20
         Top             =   3240
         Width           =   900
      End
      Begin VB.Label Label15 
         AutoSize        =   -1  'True
         Caption         =   "邮政编码:"
         Height          =   180
         Left            =   240
         TabIndex        =   19
         Top             =   3600
         Width           =   900
      End
      Begin VB.Label Label16 
         AutoSize        =   -1  'True
         Caption         =   "备注:"
         Height          =   180
         Left            =   240
         TabIndex        =   18
         Top             =   3960
         Width           =   540
      End
   End
End
Attribute VB_Name = "FrmStudentUpdate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub FillControl()
txtID.Text = ""
txtName.Text = ""
With cobSex
  .Clear
  .AddItem "男"
  .AddItem "女"
  .ListIndex = 0
End With
dtBirthday.Value = Now

'从民族表中提取记录,添加到下拉列表框中
Set adoRS = adoCon.Execute("Select Name From Nation Order By Name")
cobNation.Clear
Do While Not adoRS.EOF
  cobNation.AddItem adoRS("Name")
  adoRS.MoveNext
Loop
cobNation.ListIndex = 0

'从专业表中提取记录,添加到下拉列表框中
Set adoRS = adoCon.Execute("Select Name From Speciality Order By Name")
cobSpeciality.Clear
Do While Not adoRS.EOF
  cobSpeciality.AddItem adoRS("Name")
  adoRS.MoveNext
Loop
cobSpeciality.ListIndex = 0
txtPhone.Text = ""
txtStatusID.Text = ""
txtEmail.Text = ""
txtHouseName.Text = ""
txtHousePhone.Text = ""
txtHouseAddress.Text = ""
txtPostCode.Text = ""
txtMemo.Text = ""
End Sub
Private Sub FillRecord()
'将确认要修改信息的学生的数据添加到对应控件中
 Dim sql As String
 sql = "select * from student where id='" & frmUpdateID.sID & "'"
 Set adoRS = adoCon.Execute(sql)
 txtID.Text = adoRS("ID")
 txtName.Text = adoRS("name")
 cobSex.Text = adoRS("sex")
 dtBirthday.Value = adoRS("Birthday")
 cobSpeciality.Text = adoRS("Speciality")
 txtPhone.Text = adoRS("Phone")
 txtStatusID.Text = adoRS("Statusid")
 txtEmail.Text = adoRS("Email")
 txtHouseName.Text = adoRS("HouseName")
 txtHousePhone.Text = adoRS("HousePhone")
 txtHouseAddress.Text = adoRS("HouseAddress")
 txtPostCode.Text = adoRS("PostCode")
 txtMemo.Text = adoRS("Memo")
 Set adoRS = Nothing
End Sub

Private Sub cmdCancel_Click()
  FillRecord
End Sub

Private Sub cmdQuit_Click()
Unload Me
End Sub

Private Sub cmdUpdate_Click()
Dim sql As String
On Error GoTo errMsg
sql = MsgBox("你真的要修改当前数据吗,请慎重处理!", vbInformation _
     + vbOKCancel + vbDefaultButton2, "系统提示")
If sql = vbCancel Then
  Exit Sub
End If
'判断姓名
If Trim(txtName.Text) = "" Then
   MsgBox "姓名不能为空,请核实!", vbOKOnly + vbExclamation, "系统提示"
   txtName.SetFocus
   Exit Sub
End If
'判断出生日期,以必须是15--30岁之间这例
If (Year(Now) - Year(dtBirthday.Value)) < 15 Or (Year(Now) - Year(dtBirthday.Value)) > 30 Then
   MsgBox "输入的出生日期应保证在15--30岁间!", vbOKOnly + vbExclamation, "系统提示"
   dtBirthday.SetFocus
   Exit Sub
End If

'若电子信箱输入,则判断是否是合法的
If Trim(txtEmail.Text) <> "" Then
   '?--是任意一个字符,*--零个或任意个字符
   '邮箱必须是如下样式的:abc@jlu.com
  If txtEmail.Text Like "?*@??*.???*" = False Then
    MsgBox "输入的邮箱不是有效的信箱,请核实!", vbOKOnly + vbExclamation, "系统提示"
    txtEmail.SetFocus
    Exit Sub
  End If
End If

'若邮政编码为空不处理,若不是空的,则要判断是否是6位数字
If Trim(txtPostCode.Text) <> "" Then
    If Len(Trim(txtPostCode.Text)) <> 6 Or Not (txtPostCode.Text Like "[0-9][0-9][0-9][0-9][0-9][0-9]") Then
     MsgBox "邮政编码输入不正确,必须是6位数字,请核实!", vbOKOnly + vbExclamation, "系统提示"
     txtPostCode.SetFocus
     Exit Sub
    End If
End If
sql = ""
sql = "update student set id='" & txtID.Text & "',"
sql = sql & "Name='" & txtName.Text & "',"
sql = sql & "Sex='" & cobSex.Text & "',"
sql = sql & "Birthday='" & Format(dtBirthday.Value, "YYYY-MM-DD") & "',"
sql = sql & "Nation='" & cobNation.Text & "',"
sql = sql & "Speciality='" & cobSpeciality.Text & "',"
sql = sql & "Phone='" & txtPhone.Text & "',"
sql = sql & "StatusID='" & txtStatusID.Text & "',"
sql = sql & "Email='" & txtEmail.Text & "',"
sql = sql & "HouseName='" & txtHouseName.Text & "',"
sql = sql & "HousePhone='" & txtHousePhone.Text & "',"
sql = sql & "HouseAddress='" & txtHouseAddress.Text & "',"
sql = sql & "PostCode='" & txtPostCode.Text & "',"
sql = sql & "Memo='" & txtMemo.Text & "'"
adoCon.Execute (sql)
errMsg:
  If Err.Number <> 0 Then
     MsgBox Err.Description, , "系统错误"
  End If
  
End Sub

Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2 - 600
    '初始化窗体控件
    FillControl
    '添充窗体控件数据
    FillRecord
End Sub

⌨️ 快捷键说明

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