📄 frmstuselect.frm
字号:
EndProperty
ForeColor = &H000000C0&
Height = 735
Left = 4320
TabIndex = 1
Top = 480
Width = 2655
End
Begin VB.Image imgTitleMaximize
Height = 195
Left = 9960
Picture = "frmstuselect.frx":B48E
ToolTipText = "Maximize (Disabled)"
Top = 120
Visible = 0 'False
Width = 195
End
Begin VB.Image imgTitleclose
Height = 195
Left = 11040
Picture = "frmstuselect.frx":B6D8
ToolTipText = "Close"
Top = 120
Width = 195
End
Begin VB.Image imgTitleHelp
Height = 210
Left = 10320
Picture = "frmstuselect.frx":B922
Stretch = -1 'True
Top = 120
Width = 210
End
Begin VB.Image imgTitleMinimize
Height = 210
Left = 10680
Picture = "frmstuselect.frx":BB6C
Stretch = -1 'True
Top = 120
Width = 210
End
Begin VB.Image Imageicon
Height = 315
Left = 2640
Picture = "frmstuselect.frx":BDB6
Stretch = -1 'True
Top = 120
Width = 315
End
Begin VB.Label lblTitle
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学生选课"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 240
Left = 3840
TabIndex = 0
Top = 240
Width = 1020
End
Begin VB.Image imgWindowBottomRight
Height = 450
Left = 1080
Picture = "frmstuselect.frx":E258
Top = 0
Width = 285
End
Begin VB.Image imgWindowBottomLeft
Height = 450
Left = 720
Picture = "frmstuselect.frx":E9A2
Top = 0
Width = 285
End
Begin VB.Image imgTitleMain
Height = 450
Left = 0
Picture = "frmstuselect.frx":F0EC
Stretch = -1 'True
Top = 450
Width = 285
End
Begin VB.Image imgWindowBottom
Height = 450
Left = 360
Picture = "frmstuselect.frx":F836
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgTitleRight
Height = 450
Left = 360
Picture = "frmstuselect.frx":FF80
Top = 0
Width = 285
End
Begin VB.Image imgTitleLeft
Height = 450
Left = 0
Picture = "frmstuselect.frx":106CA
Top = 0
Width = 285
End
Begin VB.Image imgWindowRight
Height = 450
Left = 720
Picture = "frmstuselect.frx":10E14
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgWindowLeft
Height = 450
Left = 1080
Picture = "frmstuselect.frx":1155E
Stretch = -1 'True
Top = 480
Width = 285
End
End
Attribute VB_Name = "frmstuselect"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strsql As String
Dim MsgText As String
Dim rs As ADODB.Recordset
Private Sub DEcomm_Click()
Unload Me
End Sub
Private Sub dele_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim mrcc As ADODB.Recordset
Dim txtstring As String
Dim a, b, c As String
strsql = "select cno from course where cname='" & List3.Text & "'"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
If Not rs.EOF Then
a = rs.Fields(0)
End If
rs.Close
strsql = "select tno from teacher where tname='" & List4.Text & "'"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
If Not rs.EOF Then
b = rs.Fields(0)
End If
rs.Close
If List3.ListIndex <> -1 And List4.ListIndex <> -1 Then
If List3.ListIndex = List4.ListIndex Then
txtstring = "delete S_choose where cno='" & a & "'and sno= '" & user_name & "'and tno='" & b & " '"
Set rs = MyDB.ExecuteSQL(txtstring, MsgText)
List3.RemoveItem List3.ListIndex
List4.RemoveItem List4.ListIndex
MsgBox "你已经退选成功课程!"
Else
MsgBox "请正确选择课程对应的教师", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
Else
MsgBox "请同时选择课程和教师", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
MakeWindow Me
strsql = "select count(cno) from s_choose where sno='" & user_name & "'"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
If Not rs.EOF Then
Label10.Caption = rs.Fields(0)
End If
rs.Close
strsql = "select * from student where Sno='" & user_name & "'"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
If Not rs.EOF Then
Label6.Caption = rs.Fields(1)
End If
rs.Close
strsql = "select * from course"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
For i = 0 To rs.RecordCount - 1
List1.AddItem rs.Fields(1)
rs.MoveNext
Next
rs.Close
strsql = "select cname from course,s_choose where s_choose.cno=course.cno and sno='" & user_name & "'"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
For i = 0 To rs.RecordCount - 1
List3.AddItem rs.Fields(0)
rs.MoveNext
Next
rs.Close
strsql = "select tname from teacher,s_choose where teacher.tno=s_choose.tno and s_choose.sno='" & user_name & " '"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
For i = 0 To rs.RecordCount - 1
List4.AddItem rs.Fields(0)
rs.MoveNext
Next
rs.Close
strsql = "select sum(Cpoint) from course,S_choose where course.cno=S_choose.cno and S_choose.sno='" & user_name & "'"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
If Not rs.EOF Then
On Error Resume Next
Label11.Caption = rs.Fields(0)
End If
rs.Close
End Sub
Private Sub imgTitleclose_Click()
intNumField = -2
Unload Me
End Sub
Private Sub imgTitleLeft_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DoDrag Me
End Sub
Private Sub imgTitleMain_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DoDrag Me
End Sub
Private Sub imgTitleMinimize_Click()
Me.WindowState = 1
End Sub
Private Sub imgTitleRight_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DoDrag Me
End Sub
Private Sub lblTitle_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DoDrag Me
End Sub
Private Sub List1_Click()
Dim i As Integer
List2.Clear
strsql = "select * from teacher,T_choose,course where T_choose.Tno=teacher.Tno and T_choose.Cno=course.Cno and Cname='" & List1.Text & " '"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
For i = 0 To rs.RecordCount - 1
List2.AddItem rs.Fields(1)
rs.MoveNext
Next i
rs.Close
End Sub
Private Sub sccomm_Click()
frmzhakancourse.Show
End Sub
Private Sub stcomm_Click()
frmzhakanteacher.Show
End Sub
Private Sub xian_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Integer
Dim k As Integer
k = 0
Dim mrcc As ADODB.Recordset
Dim txtstring As String
Dim a, m, n As String
Dim j, p, q As Integer
strsql = "select cno from course where cname='" & List1.Text & "'"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
If Not rs.EOF Then
a = rs.Fields(0)
End If
rs.Close
strsql = "select tno from teacher where tname='" & List2.Text & "'"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
If Not rs.EOF Then
m = rs.Fields(0)
End If
rs.Close
txtstring = "select * from S_choose"
Set mrcc = MyDB.ExecuteSQL(txtstring, MsgText)
For i = 0 To List3.ListCount - 1
If List3.List(i) = List1.Text Then k = 1
Next
sqlstr = "select * from S_choose,course where S_choose.Cno=course.Cno and Cname= '" & Trim(List1.Text) & "' and Sno='" & Trim(user_name) & "'"
Set rs = MyDB.ExecuteSQL(sqlstr, MsgText)
If Not rs.EOF Then k = 1
rs.Close
strsql = "select count(cno) from s_choose where sno='" & user_name & "'"
Set rs = MyDB.ExecuteSQL(strsql, MsgText)
If Not rs.EOF Then
n = rs.Fields(0)
End If
rs.Close
If k <> 1 Then
If List1.ListIndex <> -1 And List2.ListIndex <> -1 Then
If n < 3 Then
mrcc.AddNew
mrcc.Fields(1) = user_name
mrcc.Fields(2) = a
mrcc.Fields(3) = m
mrcc.Update
MsgBox "贺喜你已经选了这门课程!"
List3.AddItem List1.Text
List4.AddItem List2.Text
mrcc.Close
Else
MsgBox "你已经超过3门课程,不能再选课", vbInformation + vbOKOnly, "提示'"
Exit Sub
End If
Else
If List1.ListIndex = -1 Then MsgBox "请选中课程", vbInformation + vbOKOnly, "提示"
If List2.ListIndex = -1 Then MsgBox "请选中教师", vbInformation + vbOKOnly, "提示"
End If
Else
MsgBox "你已经选了该课程,请重选!", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -