📄 form_studentsubject.frm
字号:
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.TextBox Text3
Height = 270
Left = 1560
TabIndex = 4
Top = 3960
Width = 1815
End
Begin VB.TextBox Text1
Height = 270
Index = 1
Left = 1560
TabIndex = 3
Top = 3360
Width = 1815
End
Begin VB.Line Line1
BorderColor = &H00808080&
BorderWidth = 2
X1 = 0
X2 = 8640
Y1 = 3120
Y2 = 3120
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "时 间"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = 480
TabIndex = 11
Top = 5160
Width = 1095
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "教 室"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = 480
TabIndex = 10
Top = 4560
Width = 1095
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "选课程编号"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 3720
TabIndex = 8
Top = 3360
Width = 1455
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "教师号"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = 4200
TabIndex = 7
Top = 3960
Width = 855
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "教师姓名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 3960
TabIndex = 2
Top = 4560
Width = 1095
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "课 程"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = 480
TabIndex = 1
Top = 3960
Width = 1095
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "学 号"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = 480
TabIndex = 0
Top = 3360
Width = 975
End
End
Attribute VB_Name = "Form_studentsubject"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command4_Click()
End Sub
Private Sub Combo1_Click()
Adodc3.ConnectionString = Connection
Adodc3.RecordSource = "select * from classroomtime where 教室与时间编号=" & Combo1.Text & ""
Adodc3.Refresh
With Adodc3.Recordset
Text3.Text = !课程
Text4.Text = !教师号
Text5.Text = !教室
Text6.Text = !上课时间
End With
End Sub
Private Sub Command2find_Click()
Combo1.Clear
Adodc2.ConnectionString = Connection
Adodc2.RecordSource = "select * from student where 学号='" & Text1(1).Text & "'"
Adodc2.Refresh
With Adodc2.Recordset
If .EOF Then
MsgBox "没有该学生!", vbOKOnly + vbExclamation, "对不起!"
Else
.MoveNext
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select * from classroomtimestudent where 学号='" & Text1(1).Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
' .MoveFirst
If Not .EOF And Not .BOF Then
While Not .EOF And Not .BOF
Combo1.AddItem !教室与时间编号
.MoveNext
Wend
Combo1.ListIndex = 0
Else
MsgBox "该生尚未选课!", vbOKOnly + vbExclamation, "对不起!"
End If
'Combo1.ListIndex = 0
End With
'Combo1.ListIndex = 0
End If
'Combo1.ListIndex = 0
End With
'Combo1.ListIndex = 0
End Sub
Private Sub Commandadd_Click()
If Combo1.Text <> "" And Text1(1).Text <> "" Then
Adodc2.ConnectionString = Connection
Adodc2.RecordSource = "select * from student where 学号='" & Text1(1).Text & "'"
Adodc2.Refresh
With Adodc2.Recordset
If .EOF Then
MsgBox "没有该学生!", vbOKOnly + vbExclamation, "对不起!"
Else
.MoveNext
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select * from classroomtimestudent where 学号='" & Text1(1).Text & "'and 教室与时间编号=" & Combo1.Text & ""
Adodc1.Refresh
With Adodc1.Recordset
If .EOF Or .BOF Then
.AddNew
!学号 = Text1(1).Text
!教室与时间编号 = Combo1.Text
'.MoveNext
.Update
Else
.MoveNext
MsgBox "你已选了这门课程!", vbOKOnly + vbExclamation, "对不起!"
Combo1.ListIndex = 0
End If
End With
End If
End With
Else
MsgBox "每个空都要添!", vbOKOnly + vbExclamation, "对不起!"
End If
End Sub
Private Sub Commandall_Click()
End Sub
Private Sub Commandclear_Click()
Combo1.Clear
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select * from classroomtimestudent order by 学号"
Adodc1.Refresh
Adodc3.ConnectionString = Connection
Adodc3.RecordSource = "select * from classroomtime"
Adodc3.Refresh
With Adodc3.Recordset
While Not .EOF And Not .BOF
Combo1.AddItem !教室与时间编号
.MoveNext
Wend
End With
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1(1).Text = ""
Text2.Text = ""
End Sub
Private Sub Commanddelete_Click()
With Adodc1.Recordset
If .EOF Or .BOF Then
MsgBox "请选择删除的记录!", vbOKOnly + vbExclamation, "警告!"
Else
.Delete
.MoveNext
End If
End With
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select * from classroomtimestudent order by 学号"
Adodc1.Refresh
Adodc3.ConnectionString = Connection
Adodc3.RecordSource = "select * from classroomtime"
Adodc3.Refresh
With Adodc3.Recordset
While Not .EOF And Not .BOF
Combo1.AddItem !教室与时间编号
.MoveNext
Wend
End With
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1(1).Text = ""
Text2.Text = ""
End Sub
Private Sub Text4_Change()
If Text4.Text <> "" Then
Adodc4.ConnectionString = Connection
Adodc4.RecordSource = "select * from teacher where 教师号='" & Text4.Text & "'"
Adodc4.Refresh
With Adodc4.Recordset
Text2.Text = !姓名
End With
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -