毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 课程设计 >> 正文

学生信息管理系统数据库实训报告 第3页

更新时间:2009-7-25:  来源:毕业论文
学生信息管理系统数据库实训报告 第3页
当输入查询类别、运算符和条件后可以查找到所需要的课程设置。
代码如下:
Dim sqlstr As String
Private Sub Command1_Click()
Dim a As String
Dim KCCX1 As String
Dim KCCX2 As String
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
    End If
End If
   
If (KCCX1 & KCCX2) = "" Then
    MsgBox "请输入查询条件!", vbOKOnly, "警告"
Exit Sub
Else
    Unload Me
    Frm_UpdateGrean.Show 1
End If
strTiaoJian = "select 专业,年级,课程名称,教材,任课老师,课程性质,考试性质 from 课程表 where " & sqlstr
Unload Me
Frm_UpdateGrean.Show 1
End Sub

Private Sub Command3_Click()
    Unload Me
End Sub
Private Sub Form_Load()
Dim i, j As Integer
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;Persist Security Info=False"
Combo1.AddItem ("专业")
Combo1.AddItem ("年级")
Combo1.AddItem ("课程名称")
Combo1.AddItem ("教材")
Combo1.AddItem ("任课老师")
Combo1.AddItem ("课程性质")
Combo1.AddItem ("考试性质")
Combo2.AddItem ("=")
Combo3.AddItem ("专业")
Combo3.AddItem ("年级")
Combo3.AddItem ("课程名称")
Combo3.AddItem ("教材")
Combo3.AddItem ("任课老师")
Combo3.AddItem ("课程性质")
Combo3.AddItem ("考试性质")
Combo4.AddItem ("=")
Combo1.Text = ""
Combo2.Text = ""
Text1.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text2.Text = ""
End Sub
班级管理:班级设置、班级查询
 
运行程序后,进入班级管理模块,班级管理模块的班级增加,在这模块中可以把专业、年级、人数、班主任、备注等信息输入,以便使用。
Dim myCon As New ADODB.Connection
Dim myRs As New ADODB.Recordset
Private Sub Command1_Click()
Dim NianJi, ZhuanYe, RenShu, FuDaoYuan, BeiZu As String
NianJi = Text1.Text
ZhuanYe = Text2.Text
RenShu = Text3.Text
FuDaoYuan = Text4.Text
BeiZu = Text5.Text
Command1.Enabled = True
If Trim(NianJi) = "" Or Trim(ZhuanYe) = "" Or Trim(RenShu) = "" Or Trim(FuDaoYuan) = "" Then
    MsgBox "资料不能为空,请填写完!"
    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) & "'  ", 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("人数") = Text3.Text
    myRs.Fields("辅导员") = Text4.Text
     If Text5.Text = "" Then
     myRs.Fields("备注") = " "
     Else
     myRs.Fields("备注") = Text5.Text
    End IfmyRs.Update
myRs.Close
myCon.Close
MsgBox "添加成功!"
Adodc1.RecordSource = "select * from 班级表 order by 年级"
Frm_AddClass.Adodc1.Refresh
Frm_AddClass.DataGrid1.RefreshText1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End SubPrivate Sub Command2_Click()
Dim NianJi, xi, RenShu, FuDaoYuan, BeiZu As StringNianJi = Text1.Text
ZhuanYe = Text2.Text
RenShu = Text3.Text
FuDaoYuan = Text4.Text
BeiZu = Text5.TextIf Trim(NianJi) = "" Or Trim(ZhuanYe) = "" Or Trim(RenShu) = "" Or Trim(FuDaoYuan) = "" Then
    MsgBox "请填写要删除资料!"
    Exit Sub
End If

上一页  [1] [2] [3] [4] [5] [6] 下一页

学生信息管理系统数据库实训报告 第3页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。