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

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

更新时间:2009-7-25:  来源:毕业论文
学生信息管理系统数据库实训报告 第5页
 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
    myRs.Fields("性别") = Combo2.Text
    myRs.Fields("民族") = Text7.Text
    myRs.Fields("籍贯") = Text8.Text
    myRs.Fields("政治面貌") = Combo1.Text
    myRs.Fields("家庭地址") = Text9.Text
    myRs.Fields("邮政编码") = Text10.Text
    myRs.Fields("联系电话") = Text11.Text
    If Text12.Text = "" Then
        myRs.Fields("备注") = " "
    Else
        myRs.Fields("备注") = Text12.Text
    End If
   
myRs.Update
myRs.Close
myCon.Close
MsgBox "添加成功!"
Adodc1.RecordSource = "select * from 学生档案 order by 学号 "
Frm_AddDangA.Adodc1.Refresh
Frm_AddDangA.DataGrid1.Refresh

Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Combo2.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo1.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End Sub

Private Sub Command2_Click()
Dim XueHao, XingMing, NianJi, ZhuanY, XingBie, MZ, JG, ZZMM, JTDZ, YZBM, LXDH, BZ As String
Dim n As Integer
XueHao = Text1.Text
XingMing = Text2.Text
NianJi = Text3.Text
ZhuanY = Text4.Text
XingBie = Combo2.Text
MZ = Text7.Text
JG = Text8.Text
ZZMM = Combo1.Text
JTDZ = Text9.Text
YZBM = Text10.Text
LXDH = Text11.Text

BZ = Text12.Text
If Trim(XueHao) = "" Or Trim(XingMing) = "" Or Trim(NianJi) = "" Or Trim(XingBie) = "" Or Trim(MZ) = "" Or Trim(JG) = "" Or Trim(ZZMM) = "" Or Trim(JTDZ) = "" Or Trim(YZBM) = "" Or Trim(LXDH) = "" Then
    MsgBox "请填写要删除的资料!"
    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_AddDangA.Adodc1.Refresh
Frm_AddDangA.DataGrid1.Refresh
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Combo2.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo1.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End Sub

Private Sub Command3_Click()
    Unload Me
End Sub

Private Sub DataGrid1_Click()
Frm_AddDangA.Adodc1.RecordSource = "select * from 学生档案 where 学号 = '" & Trim(DataGrid1.Row) & "'"
Text1.Text = Frm_AddDangA.Adodc1.Recordset.Fields("学号")
Text2.Text = Frm_AddDangA.Adodc1.Recordset.Fields("姓名")
Text3.Text = Frm_AddDangA.Adodc1.Recordset.Fields("年级")
Text4.Text = Frm_AddDangA.Adodc1.Recordset.Fields("专业")
Combo2.Text = Frm_AddDangA.Adodc1.Recordset.Fields("性别")
Text7.Text = Frm_AddDangA.Adodc1.Recordset.Fields("民族")
Text8.Text = Frm_AddDangA.Adodc1.Recordset.Fields("籍贯")
Combo1.Text = Frm_AddDangA.Adodc1.Recordset.Fields("政治面貌")
Text9.Text = Frm_AddDangA.Adodc1.Recordset.Fields("家庭地址")
Text10.Text = Frm_AddDangA.Adodc1.Recordset.Fields("邮政编码")
Text11.Text = Frm_AddDangA.Adodc1.Recordset.Fields("联系电话")
Text12.Text = Frm_AddDangA.Adodc1.Recordset.Fields("备注")
Command2.Enabled = True
End Sub

Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;Persist Security Info=False"
    Combo2.AddItem ("男")
    Combo2.AddItem ("女")
    Combo1.AddItem ("团员")
    Combo1.AddItem ("党员")
    Combo1.AddItem ("无")
    Combo2.Text = ""
End Sub
 
当输入查询类别、运算符和条件后可以查找到所需要的课程设置。
代码如下:
Dim sqlstr As String
Private Sub Command1_Click()
Dim a As String
Dim XSDA1 As String
Dim XSDA2 As String
a = Trim(Combo2)
Select Case a
    Case "="
        XSDA1 = "" & Combo1.Text & " " & Combo2.Text & " '" & Trim(Text1) & "'"
    Case "like"
        XSDA1 = "Instr(1," & Combo1.Text & ",'" & Trim(Text1.Text) & "')<>0 "
End Select
a = Trim(Combo4)
Select Case a
    Case "="
        XSDA2 = "" & Combo3.Text & " " & Combo4.Text & " '" & Trim(Text2) & "'"
    Case "like"
www.youerw.com
            strTiaoJian = "select * from 学生档案 where " & XSDA1
        Else
            strTiaoJian = "select * from 学生档案 where " & XSDA1 & "and " & XSDA2
    End If
ElseIf Option3.Value = True Then
    If XSDA1 = "" Then
            strTiaoJian = "select * from 学生档案 where " & XSDA2
    ElseIf XSDA2 = "" Then
            strTiaoJian = "select * from 学生档案 where " & XSDA1
        Else
            strTiaoJian = "select * from 学生档案 where " & XSDA1 & "or " & XSDA2
    End If
Else
    If XSDA1 = "" Then
        strTiaoJian = "select * from 学生档案 where " & XSDA2
    ElseIf XSDA2 = "" Then
        strTiaoJian = "select * from 学生档案 where " & XSDA1
    End If
End If
   
If (XSDA1 & XSDA2) = "" Then
    MsgBox "请输入查询条件!", vbOKOnly, "警告"
Exit Sub
Else
    Unload Me
    Frm_UpdateDangA.Show 1
End If

    strTiaoJian = "select * from 学生档案 where " & sqlstr
    Unload Me
    Frm_UpdateDangA.Show 1
End Sub

Private Sub Command3_Click()
    Unload Me
End Sub

Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;Persist Security Info=False"
Combo1.AddItem ("学号")
Combo1.AddItem ("姓名")
Combo1.AddItem ("年级")
Combo1.AddItem ("专业")

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

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

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