表3-5 上课表(study)
列名 含义 长度 类型 NULL DEFAULT
Classroom number 教室号 4 Char() no no
Stu_number 学号 8 Char() no no
Study time 上课时间 8 Char() no no
表3-6选课表(selective)
列名 含义 长度 类型 NULL DEFAULT
Stu_number 学号 8 Char() no no
Course code 课程编号 8 Char() no no
2.5物理结构设计
Dim myCon As New ADODB.Connection
Dim myRs As New ADODB.Recordset
Private Sub Command1_Click()
Dim ZhuanYe, NianJi, KeCheng, JiaoCai, RenKLS, KeChengXZ, KaoShiXZ As String
ZhuanYe = Text1.Text
NianJi = Text2.Text
KeCheng = Text4.Text
JiaoCai = Text5.Text
RenKLS = Text6.Text
KeChengXZ = Combo1.Text
KaoShiXZ = Combo2.Text
If Trim(ZhuanYe) = "" Or Trim(NianJi) = "" Or Trim(KeCheng) = "" Or Trim(JiaoCai) = "" Or Trim(RenKLS) = "" Or Trim(KeChengXZ) = "" Or Trim(KaoShiXZ) = "" Then
MsgBox "基本课程设置资料不能为空,请填写完整!"
Combo1.Text = ""
Combo2.Text = ""
Exit Sub
End If
myCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;"
myRs.Open "select * from 课程表 where 专业= '" & Trim(Text1.Text) & "' and 年级='" & Trim(Text2.Text) & "' and 课程名称='" & Trim(Text4.Text) & "' ", myCon
If myRs.EOF = False Then
MsgBox "该课程已经存在,请重新输入!"
myRs.Close
myCon.Close
Text1.SetFocus
Exit Sub
End If
myRs.Close
myRs.Open "课程表", myCon, 3, 2
myRs.AddNew
myRs.Fields("专业") = Text1.Text
myRs.Fields("年级") = Text2.Text
myRs.Fields("课程名称") = Text4.Text
myRs.Fields("教材") = Text5.Text
myRs.Fields("任课老师") = Text6.Text
myRs.Fields("课程性质") = Combo1.Text
myRs.Fields("考试性质") = Combo2.Text
myRs.Update
myRs.Close
myCon.Close
MsgBox "添加成功!"
Adodc1.RecordSource = "select * from 课程表 order by 专业"
Frm_SheZGrean.Adodc1.Refresh
Frm_SheZGrean.DataGrid1.Refresh
Text1.Text = ""
Text2.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Combo1.Text = ""
Combo2.Text = ""
End Sub
Private Sub Command2_Click()
Dim ZhuanYe, NianJi, KeCheng, JiaoCai, RenKLS, KeChengXZ, KaoShiXZ As String
Dim n As Integer
ZhuanYe = Text1.Text
NianJi = Text2.Text
KeCheng = Text4.Text
JiaoCai = Text5.Text
RenKLS = Text6.Text
KeChengXZ = Combo1.Text
KaoShiXZ = Combo2.Text
If Trim(ZhuanYe) = "" Or Trim(NianJi) = "" Or Trim(KeCheng) = "" Or Trim(JiaoCai) = "" Or Trim(RenKLS) = "" Or Trim(KeChengXZ) = "" Or Trim(KaoShiXZ) = "" Then
MsgBox "请填写要删除的资料!"
Combo1.Text = ""
Combo2.Text = ""
Exit Sub
End If
If myCon.State = 1 Then
myCon.Close
End If
myCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;"
myRs.Open "select * from 课程表 where 专业='" & Text1.Text & "'", myCon, 3, 2
n = MsgBox("您确定要删除吗?", vbYesNo, "提示")
If n = 6 Then
MsgBox ("删除成功!")
myRs.Delete
myRs.Close
myCon.Close
End If
Adodc1.RecordSource = "select * from 课程表 order by 专业"
Frm_SheZGrean.Adodc1.Refresh
Frm_SheZGrean.DataGrid1.Refresh
Text1.Text = ""
Text2.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Combo1.Text = ""
Combo2.Text = ""
End SubPrivate Sub Command3_Click()
Unload Me
End SubPrivate Sub DataGrid1_Click()
Frm_SheZGrean.Adodc1.RecordSource = "select * from 课程表 where 专业 = '" & Trim(DataGrid1.Row) & "'"
Text1.Text = Frm_SheZGrean.Adodc1.Recordset.Fields("专业")
Text2.Text = Frm_SheZGrean.Adodc1.Recordset.Fields("年级")
Text4.Text = Frm_SheZGrean.Adodc1.Recordset.Fields("课程名称")
Text5.Text = Frm_SheZGrean.Adodc1.Recordset.Fields("教材")
Text6.Text = Frm_SheZGrean.Adodc1.Recordset.Fields("任课老师")
Combo1.Text = Frm_SheZGrean.Adodc1.Recordset.Fields("课程性质")
Combo2.Text = Frm_SheZGrean.Adodc1.Recordset.Fields("考试性质")
Command2.Enabled = True
End Sub
Private Sub Form_Load()
Combo1.AddItem ("必修")
Combo1.AddItem ("选修")
Combo1.AddItem ("自开")
Combo2.AddItem ("考试")
Combo2.AddItem ("查考")
Text1.Text = ""
Text2.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Combo1.Text = ""
Combo2.Text = ""
End Sub
上一页 [1] [2] [3] [4] [5] [6] 下一页