附:源程序
7.1.1课程管理:课程设置
下面为其代码:
Private Sub Command1_Click()
Dim myCon As New ADODB.Connection
Dim myRs As New ADODB.Recordset
Dim ZhuanYe, NianJi, XueQi, KeCheng, JiaoCai, RenKLS, KeShi, ShangKeDD, KeChengXZ, KaoShiXZ As String
ZhuanYe = Text1.Text
NianJi = Text2.Text
XueQi = DTPicker1.Value
KeCheng = Text4.Text
JiaoCai = Text5.Text
RenKLS = Text6.Text
KeShi = Text7.Text
ShangKeDD = Text8.Text
KeChengXZ = Combo1.Text
KaoShiXZ = Combo2.Text
If Trim(ZhuanYe) = "" Or Trim(NianJi) = "" Or Trim(XueQi) = "" Or Trim(KeCheng) = "" Or Trim(JiaoCai) = "" Or Trim(RenKLS) = "" Or Trim(KeShi) = "" Or Trim(ShangKeDD) = "" Or Trim(KeChengXZ) = "" Or Trim(KaoShiXZ) = "" Then
MsgBox "请填写要修改课程资料的内容!"
Combo1.Text = ""
Combo2.Text = ""
Exit Sub
End If
myCon.Open "dsn=信息"
myRs.Open "select * from 课程表 where 专业='" & Text1.Text & "'", myCon, 3, 2
myRs!年级 = Text2.Text
myRs!学期 = DTPicker1.Value
myRs!课程名称 = Text4.Text
myRs!教材 = Text5.Text
myRs!任课老师 = Text6.Text
myRs!课时 = Text7.Text
myRs!上课地点 = Text8.Text
myRs!课程性质 = Combo1.Text
myRs!考试性质 = Combo2.Text
myRs.Update
myRs.Close
myCon.Close
MsgBox "您确定要修改吗?", vbYesNo, "提示"
Frm_UpdateGrean.Adodc1.Refresh
Frm_UpdateGrean.DataGrid1.Refresh
Text1.Text = ""
Text2.Text = ""
'Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo1.Text = ""
Combo2.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Unload Me
Frm_FindGrean.Show 1
End Sub
Private Sub DataGrid1_Click()
'Frm_UpdateGrean.Adodc1.RecordSource = "select * from 课程表 where 专业 = '" & Trim(DataGrid1.Row) & "'"
'Text1.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("专业")
'Text2.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("年级")
'Text3.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("学期")
'Text4.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("课程名称")
'Text5.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("教材")
'Text6.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("任课老师")
'Text7.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("课时")
'Text8.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("上课地点")
'Combo1.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("课程性质")
'Combo2.Text = Frm_UpdateGrean.Adodc1.Recordset.Fields("考试性质")
End Sub
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
End Sub
Private Sub Form_Activate()
Frm_FindGrean.Adodc1.RecordSource = strTiaoJian
Frm_FindGrean.Adodc1.Refresh
Set DataGrid1.DataSource = Frm_FindGrean.Adodc1
End Sub
Private Sub Form_Load()
Combo1.AddItem ("必修")
Combo1.AddItem ("选修")
Combo1.AddItem ("自开")
Combo2.AddItem ("考试")
Combo2.AddItem ("查考")
Text1.Text = ""
Text2.Text = ""
'Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo1.Text = ""
Combo2.Text = ""
End Sub
Private Sub Text1_Change()
End Sub
Private Sub Text2_Change()
End Sub
Private Sub Text8_Change()
End Sub
课程管理:课程查询
当输入查询类别、运算符和条件后可以查找到所需要的课程设置,或按查询时间来查询,输入所要查找的时间段,就可查到所要的课程设置。
代码如下:
Dim sqlstr As String
Private Sub Combo1_Change()
End Sub
Private Sub Combo2_Change()
End Sub
Private Sub Combo4_Change()
End Sub
Private Sub Combo5_Change()
End Sub
Private Sub Combo7_Change()
End Sub
Private Sub Command1_Click()
Dim a As String
Dim KCCX1 As String
Dim KCCX2 As String
Dim str1 As String
Dim str2 As String
If Option3.Value = True Then
a = Trim(Combo2)
Select Case a
Case "="
KCCX1 = "" & Combo1.Text & " " & Combo2.Text & " '" & Trim(Text1) & "'"
Case "like"
KCCX1 = "Instr(1," & Combo1.Text & ",'" & Trim(Text1.Text) & "')<>0 "
End Select
a = Trim(Combo4)
Select Case a
Case "="
KCCX2 = "" & Combo3.Text & " " & Combo4.Text & " '" & Trim(Text2) & "'"
Case "like"
KCCX2 = "Instr(1," & Combo3.Text & ",'" & Trim(Text2.Text) & "')<>0 "
End Select
If Option1.Value = True Then
If KCCX1 = "" Then
strTiaoJian = "select * from 课程表 where " & KCCX2
ElseIf KCCX2 = "" Then
strTiaoJian = "select * from 课程表 where " & KCCX1
Else
strTiaoJian = "select * from 课程表 where " & KCCX1 & "and " & KCCX2
End If
ElseIf Option2.Value = True Then
If KCCX1 = "" Then
strTiaoJian = "select * from 课程表 where " & KCCX2
ElseIf KCCX2 = "" Then
strTiaoJian = "select * from 课程表 where " & KCCX1
Else
strTiaoJian = "select * from 课程表 where " & KCCX1 & "or " & KCCX2
End If
Else
If KCCX1 = "" Then
strTiaoJian = "select * from 课程表 where " & KCCX2
ElseIf KCCX2 = "" Then
strTiaoJian = "select * from 课程表 where " & KCCX1
Else
MsgBox "请选择连接方式!", vbOKOnly, "警告"
Exit Sub
End If
End If
If (KCCX1 & KCCX2) = "" Then
MsgBox "请输入查询类别!", vbOKOnly, "警告"
Exit Sub
Else
Unload Me
Frm_UpdateGrean.Show 1
End If
End If
If Option4.Value = True Then
If Val(Combo6) > Val(Combo9) Then
MsgBox "请正确选择年份!", vbOKOnly + vbExclamation, "信息提示"
Combo6.SetFocus
Exit Sub
Else
If Val(Combo6) = Val(Combo9) Then
If Val(Combo7) > Val(Combo10) Then
MsgBox "请正确选择月份!", vbOKOnly + vbExclamation, "信息提示"
Combo7.SetFocus
Exit Sub
Else
If Val(Combo7) = Val(Combo10) Then
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页