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

📄 frmliveupdate2.frm

📁 用VB实现的一个学生管理系统
💻 FRM
📖 第 1 页 / 共 4 页
字号:
sql = sql & " Values('" & Trim(txtnumber4.Text) & "'"
sql = sql & ",'" & Trim(txtname4.Text) & "'"
sql = sql & ",'" & Trim(txtsex4.Text) & "'"
sql = sql & ",'" & Trim(txtsp4.Text) & "'"
sql = sql & ",'" & Trim(txtclass4.Text) & "'"
sql = sql & ",'" & Trim(sushe) & "')"
'执行插入
adoCon.Execute (sql)
ElseIf a4 <> "" And txtname4.Enabled = True Then
sql = ""
sql = "update Room set 学号='" & Trim(txtnumber4.Text) & "',"
sql = sql & "姓名='" & Trim(txtname4.Text) & "',"
sql = sql & "性别='" & Trim(txtsex4.Text) & "',"
sql = sql & "专业='" & Trim(txtsp4.Text) & "',"
sql = sql & "班别='" & Trim(txtclass4.Text) & "',"
sql = sql & "宿舍='" & Trim(sushe) & "'"
sql = sql & " Where 学号='" & a4 & "'"
adoCon.Execute (sql)
End If



sql = MsgBox("修改成功!", vbInformation _
     + vbOK, "系统提示")

errMsg:
  If Err.Number <> 0 Then
     MsgBox Err.Description, , "系统错误"
  End If

End Sub



Private Sub cobclass_Click()
If Option1.Value = True Then
Option1.Value = False
End If
If Option2.Value = True Then
Option2.Value = False
End If

End Sub

Private Sub cobcollege_Click()
'专业
sql = ""
sql = "select 专业 from Spcollege where 学院='" & cobcollege.Text & "'"
Set adoRS = adoCon.Execute(sql)

cobsp.Clear
Do While Not adoRS.EOF
  cobsp.AddItem Trim(adoRS("专业"))
  adoRS.MoveNext
Loop
cobsp.ListIndex = 0
End Sub

Private Sub cobsp_Click()
'班级
sql = ""
sql = "select 班级 from Spclass where  专业='" & cobsp.Text & "'"
Set adoRS = adoCon.Execute(sql)

cobclass.Clear
Do While Not adoRS.EOF
  cobclass.AddItem Trim(adoRS("班级"))
  adoRS.MoveNext
Loop
cobclass.ListIndex = 0
Option1.Value = False
Option2.Value = False

End Sub


Private Sub Combo1_Click()
'专业
sql = ""
sql = "select 专业 from Spclass where  学院='" & cobcollege.Text & "'"
Set adoRS = adoCon.Execute(sql)

cobsp.Clear
Do While Not adoRS.EOF
  cobsp.AddItem Trim(adoRS("专业"))
  adoRS.MoveNext
Loop
cobsp.ListIndex = 0
End Sub

Private Sub Command10_Click()
'修改床位3
sql = ""
sql = "delete Room where 学号='" & Trim(txtnumber3.Text) & "'"
adoCon.Execute (sql)

txtnumber3.Text = ""
txtname3.Text = ""
txtsex3.Text = ""
txtsp3.Text = ""
txtclass3.Text = ""
txtname3.BackColor = &H80000013
txtsex3.BackColor = &H80000013
txtsp3.BackColor = &H80000013
txtclass3.BackColor = &H80000013
txtname3.Enabled = False
txtsex3.Enabled = False
txtsp3.Enabled = False
txtclass3.Enabled = False

End Sub

Private Sub Command11_Click()
'修改床位4
sql = ""
sql = "delete Room where 学号='" & Trim(txtnumber4.Text) & "'"
adoCon.Execute (sql)

txtnumber4.Text = ""
txtname4.Text = ""
txtsex4.Text = ""
txtsp4.Text = ""
txtclass4.Text = ""
txtname4.BackColor = &H80000013
txtsex4.BackColor = &H80000013
txtsp4.BackColor = &H80000013
txtclass4.BackColor = &H80000013
txtname4.Enabled = False
txtsex4.Enabled = False
txtsp4.Enabled = False
txtclass4.Enabled = False

End Sub

Private Sub Command12_Click(Index As Integer)
If List1.ListIndex < 0 Then
   MsgBox "请选择学生!", vbOKOnly + vbExclamation, "系统提示"
Exit Sub
End If

Select Case Index

Case 0
'学生1
If Option1.Value = True Then
 sql = "select * from Student where ID='" & Trim(List1.Text) & "'"
End If
If Option2.Value = True Then
 sql = "select * from Student where Name='" & Trim(List1.Text) & "'"
End If
 Set adoRS = adoCon.Execute(sql)
 If adoRS.EOF Then
   MsgBox "对不起,查无此人,请执行系统查询功能," _
          & vbCrLf & vbCrLf & "确认要录入宿舍的学号后再进行录入。", _
          vbInformation + vbOKOnly, "系统提示"
   Exit Sub
Else
 txtclass1.Enabled = True
 txtclass1.BackColor = &H80000005
 a(0) = txtclass1.Text
 
 txtclass1.Text = adoRS("Class")
 txtsp1.Enabled = True
 txtsp1.BackColor = &H80000005
 a(1) = txtsp1.Text
 
 txtsp1.Text = adoRS("Speciality")
 txtsp1.BackColor = &H80000005
 txtsex1.Enabled = True
 txtsex1.BackColor = &H80000005
 a(2) = txtsex1.Text
 
 txtsex1.Text = adoRS("Sex")
 
 txtname1.Enabled = True
 txtname1.BackColor = &H80000005
 a(3) = txtname1.Text

 txtname1.Text = adoRS("Name")
 txtnumber1.Enabled = True
 txtnumber1.BackColor = &H80000005
 a(4) = txtnumber1.Text
 txtnumber1.Text = adoRS("ID")
 
 Command8.Enabled = True
End If
 If txtnumber1.Text = txtnumber2.Text Or txtnumber1.Text = txtnumber3.Text Or txtnumber4.Text = txtnumber1.Text Then
txtclass1.Text = a(0)
txtsp1.Text = a(1)
txtsex1.Text = a(2)
txtname1.Text = a(3)
txtnumber1.Text = a(4)
 If a(0) = "" Then
 txtclass1.Enabled = False
 txtsp1.Enabled = False
 txtsex1.Enabled = False
 txtname1.Enabled = False
 Command8.Enabled = False
 txtname1.BackColor = &H80000013
txtsex1.BackColor = &H80000013
txtsp1.BackColor = &H80000013
txtclass1.BackColor = &H80000013
End If

 MsgBox "学生不能重复,请核实!", vbOKOnly + vbExclamation, "系统提示"
End If
  Set adoRS = Nothing
  
    Case 1
'学生2
If Option1.Value = True Then
 sql = "select * from Student where ID='" & Trim(List1.Text) & "'"
End If
If Option2.Value = True Then
 sql = "select * from Student where Name='" & Trim(List1.Text) & "'"
End If
 Set adoRS = adoCon.Execute(sql)
 If adoRS.EOF Then
   MsgBox "对不起,查无此人,请执行系统查询功能," _
          & vbCrLf & vbCrLf & "确认要录入宿舍的学号后再进行录入。", _
          vbInformation + vbOKOnly, "系统提示"
   Exit Sub
Else
 txtclass2.Enabled = True
 txtclass2.BackColor = &H80000005
a(0) = txtclass2.Text
 
 txtclass2.Text = adoRS("Class")
 txtsp2.Enabled = True
 txtsp2.BackColor = &H80000005
a(1) = txtsp2.Text
 
 txtsp2.Text = adoRS("Speciality")
 txtsp2.BackColor = &H80000005
 txtsex2.Enabled = True
 txtsex2.BackColor = &H80000005
a(2) = txtsex2.Text
 
 txtsex2.Text = adoRS("Sex")
 txtname2.Enabled = True
 txtname2.BackColor = &H80000005
a(3) = txtname2.Text
 
 txtname2.Text = adoRS("Name")
 txtnumber2.Enabled = True
 txtnumber2.BackColor = &H80000005
 a(4) = txtnumber2.Text

 txtnumber2.Text = adoRS("ID")
 Command9.Enabled = True
End If
 If txtnumber1.Text = txtnumber2.Text Or txtnumber2.Text = txtnumber3.Text Or txtnumber4.Text = txtnumber2.Text Then
txtclass2.Text = a(0)
txtsp2.Text = a(1)
txtsex2.Text = a(2)
txtname2.Text = a(3)
txtnumber2.Text = a(4)
 If a(0) = "" Then
 txtclass2.Enabled = False
 txtsp2.Enabled = False
 txtsex2.Enabled = False
 txtname2.Enabled = False
 Command9.Enabled = False
 txtname2.BackColor = &H80000013
txtsex2.BackColor = &H80000013
txtsp2.BackColor = &H80000013
txtclass2.BackColor = &H80000013
End If

 MsgBox "学生不能重复,请核实!", vbOKOnly + vbExclamation, "系统提示"
End If
  Set adoRS = Nothing
  
Case 2
'学生3
If Option1.Value = True Then
 sql = "select * from Student where ID='" & Trim(List1.Text) & "'"
End If
If Option2.Value = True Then
 sql = "select * from Student where Name='" & Trim(List1.Text) & "'"
End If
 Set adoRS = adoCon.Execute(sql)
 If adoRS.EOF Then
   MsgBox "对不起,查无此人,请执行系统查询功能," _
          & vbCrLf & vbCrLf & "确认要录入宿舍的学号后再进行录入。", _
          vbInformation + vbOKOnly, "系统提示"
   Exit Sub
Else
 txtclass3.Enabled = True
 txtclass3.BackColor = &H80000005
 a(0) = txtclass3.Text
 
 txtclass3.Text = adoRS("Class")
 txtsp3.Enabled = True
 txtsp3.BackColor = &H80000005
 a(1) = txtsp3.Text
 
 txtsp3.Text = adoRS("Speciality")
 txtsp3.BackColor = &H80000005
 txtsex3.Enabled = True
 txtsex3.BackColor = &H80000005
 a(2) = txtsex3.Text
 
 txtsex3.Text = adoRS("Sex")
 
 txtname3.Enabled = True
 txtname3.BackColor = &H80000005
 a(3) = txtname3.Text

 txtname3.Text = adoRS("Name")
 txtnumber3.Enabled = True
 txtnumber3.BackColor = &H80000005
 a(4) = txtnumber3.Text
 txtnumber3.Text = adoRS("ID")
 
 Command10.Enabled = True
End If
 If txtnumber1.Text = txtnumber3.Text Or txtnumber2.Text = txtnumber3.Text Or txtnumber4.Text = txtnumber3.Text Then
txtclass3.Text = a(0)
txtsp3.Text = a(1)
txtsex3.Text = a(2)
txtname3.Text = a(3)
txtnumber3.Text = a(4)
 If a(0) = "" Then
 txtclass3.Enabled = False
 txtsp3.Enabled = False
 txtsex3.Enabled = False
 txtname3.Enabled = False
 Command10.Enabled = False
 txtname3.BackColor = &H80000013
txtsex3.BackColor = &H80000013
txtsp3.BackColor = &H80000013
txtclass3.BackColor = &H80000013
End If

 MsgBox "学生不能重复,请核实!", vbOKOnly + vbExclamation, "系统提示"
End If
  Set adoRS = Nothing

Case 3
'学生4
If Option1.Value = True Then
 sql = "select * from Student where ID='" & Trim(List1.Text) & "'"
End If
If Option2.Value = True Then
 sql = "select * from Student where Name='" & Trim(List1.Text) & "'"
End If
 Set adoRS = adoCon.Execute(sql)
 If adoRS.EOF Then
   MsgBox "对不起,查无此人,请执行系统查询功能," _
          & vbCrLf & vbCrLf & "确认要录入宿舍的学号后再进行录入。", _
          vbInformation + vbOKOnly, "系统提示"
   Exit Sub
Else
 txtclass4.Enabled = True
 txtclass4.BackColor = &H80000005
 a(0) = txtclass4.Text
 
 txtclass4.Text = adoRS("Class")
 txtsp4.Enabled = True
 txtsp4.BackColor = &H80000005
 a(1) = txtsp4.Text
 
 txtsp4.Text = adoRS("Speciality")
 txtsp4.BackColor = &H80000005
 txtsex4.Enabled = True
 txtsex4.BackColor = &H80000005
 a(2) = txtsex4.Text
 
 txtsex4.Text = adoRS("Sex")
 
 txtname4.Enabled = True
 txtname4.BackColor = &H80000005
 a(3) = txtname4.Text

 txtname4.Text = adoRS("Name")
 txtnumber4.Enabled = True
 txtnumber4.BackColor = &H80000005
 a(4) = txtnumber4.Text
 txtnumber4.Text = adoRS("ID")
 
 Command11.Enabled = True
End If
 If txtnumber1.Text = txtnumber4.Text Or txtnumber2.Text = txtnumber4.Text Or txtnumber4.Text = txtnumber3.Text Then
txtclass4.Text = a(0)
txtsp4.Text = a(1)
txtsex4.Text = a(2)
txtname4.Text = a(3)
txtnumber4.Text = a(4)
 If a(0) = "" Then
 txtclass4.Enabled = False
 txtsp4.Enabled = False
 txtsex4.Enabled = False
 txtname4.Enabled = False
 Command11.Enabled = False
 txtname4.BackColor = &H80000013
txtsex4.BackColor = &H80000013
txtsp4.BackColor = &H80000013
txtclass4.BackColor = &H80000013
End If

 MsgBox "学生不能重复,请核实!", vbOKOnly + vbExclamation, "系统提示"
End If
  Set adoRS = Nothing

⌨️ 快捷键说明

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