📄 form11.frm
字号:
VERSION 5.00
Begin VB.Form Form11
BorderStyle = 3 'Fixed Dialog
Caption = "学生选课"
ClientHeight = 5760
ClientLeft = 45
ClientTop = 375
ClientWidth = 6420
LinkTopic = "Form11"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5760
ScaleWidth = 6420
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Caption = "选课:"
Height = 2055
Left = 600
TabIndex = 4
Top = 3240
Width = 5175
Begin VB.CommandButton Command3
Caption = "退课"
Height = 375
Left = 2040
TabIndex = 9
Top = 1200
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "刷新"
Height = 375
Left = 3360
TabIndex = 8
Top = 1200
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "选课"
Height = 375
Left = 720
TabIndex = 7
Top = 1200
Width = 1095
End
Begin VB.TextBox Text1
Height = 390
Left = 2280
TabIndex = 6
Top = 465
Width = 1575
End
Begin VB.Label Label3
Caption = "输入课序号:"
Height = 255
Left = 1200
TabIndex = 5
Top = 600
Width = 1335
End
End
Begin VB.ListBox List2
Height = 2040
Left = 3000
TabIndex = 2
Top = 720
Width = 2775
End
Begin VB.ListBox List1
Height = 2040
Left = 600
TabIndex = 0
Top = 720
Width = 1815
End
Begin VB.Label Label2
Caption = "所有课程:"
Height = 375
Left = 3000
TabIndex = 3
Top = 360
Width = 2175
End
Begin VB.Label Label1
Caption = "已选课程:"
Height = 375
Left = 600
TabIndex = 1
Top = 360
Width = 2175
End
End
Attribute VB_Name = "Form11"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs_test As New ADODB.Recordset
Private Sub Command1_Click()
sql = "select * from choose"
Call Conn
rs_test.Open sql, Module1.conn_mdb, 3, 3
rs_test.AddNew
rs_test("l_id") = Text1.Text
rs_test("s_id") = id
rs_test.Update
Call conclose
End Sub
Private Sub Command2_Click()
List1.Clear
Call Form_Load
End Sub
Private Sub Command3_Click()
sql = "select * from choose where l_id=" & Text1.Text & "and s_id=" & id
Call Conn
rs_test.Open sql, Module1.conn_mdb, 3, 3
rs_test.Delete
rs_test.Update
Call conclose
End Sub
Private Sub Form_Load()
Dim sql As String
sql = "select * from lesson"
Call Conn
rs_test.Open sql, Module1.conn_mdb, 3, 3
rs_test.MoveFirst
List2.List(0) = "课程名 课序号"
i = 1
While (Not rs_test.EOF)
List2.List(i) = rs_test("l_name") & rs_test("l_id")
rs_test.MoveNext
i = i + 1
Wend
Call conclose
i = 0
sql = "select l_name,choose.l_id from student,lesson,choose where student.s_id=choose.s_id and lesson.l_id=choose.l_id and student.s_id=" & id
Call Conn
rs_test.Open sql, Module1.conn_mdb, 3, 3
rs_test.MoveFirst
While (Not rs_test.EOF)
List1.List(i) = rs_test("l_name")
rs_test.MoveNext
i = i + 1
Wend
Call conclose
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -